Skip to content

Added Edmonds-Karp Algorithm Implementation #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pankaj-bind
Copy link

close issue #46

What's Added

  • AIEdmondsKarp class: Complete implementation of the Edmonds-Karp algorithm using BFS to find augmenting paths
  • AIEdmondsKarpTest class: Comprehensive test suite covering various network flow scenarios
  • Integration: Follows existing repository patterns and integrates with current node/edge classes

Key features:

  • Uses BFS to find augmenting paths from source to sink
  • Maintains residual graph with forward and reverse edges
  • Handles flow updates and capacity constraints correctly
  • Returns maximum flow value between source and sink nodes

Test Coverage

The test suite includes:

  • ✅ Basic maximum flow computation
  • ✅ Complex network scenarios
  • ✅ Single edge cases
  • ✅ No path scenarios (disconnected graphs)

Technical Implementation

  • Extends: AIGraphAlgorithm (follows repository patterns)
  • Uses: AINetworkFlowEdge for capacity and flow tracking
  • Node type: AIPathDistanceNode for BFS traversal
  • Method signature: source:sink: (matches existing flow algorithms like AIDinic)

Integration

  • Adds new "Maximum Flow" tag to AI-Algorithms-Graph package
  • Compatible with existing baseline and CI setup
  • Follows same coding conventions as other algorithms
  • Ready for inclusion in README algorithm list

@jordanmontt please review this PR

@Ducasse
Copy link
Contributor

Ducasse commented Jun 5, 2025

Super nice!
I will let seb to comment in details but this is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants