Expand description
Network flow algorithms for graph processing
This module contains algorithms for finding maximum flows, minimum cuts, min-cost max flows, multi-commodity flows, and bipartite matching.
§Algorithms
- Edmonds-Karp: Max flow via Ford-Fulkerson with BFS (O(VE^2))
- Dinic’s: Max flow via blocking flows and level graphs (O(V^2 E))
- Push-Relabel: Max flow via preflow and relabeling (O(V^2 sqrt(E)))
- Min-Cut: Minimum s-t cut derived from max flow
- Min-Cost Max Flow: Successive shortest paths algorithm
- Multi-Commodity Flow: LP relaxation approximation
- Hopcroft-Karp: Maximum bipartite matching (O(E sqrt(V)))
Structs§
- Cost
Edge - Edge with both capacity and cost
- Hopcroft
Karp Result - Result of Hopcroft-Karp bipartite matching
- MaxFlow
Result - Result of a max-flow computation
- MinCost
Flow Result - Result of a min-cost max-flow computation
- Multi
Commodity Flow Result - Result of a multi-commodity flow computation
Functions§
- capacity_
scaling_ max_ flow - Capacity scaling algorithm for maximum flow. Uses Edmonds-Karp with capacity scaling for better performance on high-capacity graphs.
- dinic_
max_ flow - Dinic’s algorithm for maximum flow.
- dinic_
max_ flow_ full - Dinic’s algorithm returning full flow result.
- edmonds_
karp_ max_ flow - Edmonds-Karp algorithm for maximum flow (Ford-Fulkerson with BFS).
- ford_
fulkerson_ max_ flow - Ford-Fulkerson max flow using BFS (Edmonds-Karp variant).
- hopcroft_
karp - Hopcroft-Karp algorithm for maximum bipartite matching.
- isap_
max_ flow - ISAP (Improved Shortest Augmenting Path) algorithm for maximum flow. Delegates to Dinic’s which has similar complexity.
- min_
cost_ max_ flow - Min-cost max flow using successive shortest paths (Bellman-Ford).
- min_
cost_ max_ flow_ graph - Min-cost max flow on a DiGraph with separate cost function.
- minimum_
cut - Find minimum s-t cut using max flow.
- minimum_
st_ cut - Find minimum s-t cut from max flow result.
- multi_
commodity_ flow - Multi-commodity flow using LP relaxation via iterative proportional scaling.
- multi_
source_ multi_ sink_ max_ flow - Multi-source multi-sink maximum flow.
- parallel_
max_ flow - Parallel maximum flow algorithm. Currently delegates to Dinic’s; parallelism is a future optimization.
- push_
relabel_ max_ flow - Push-relabel algorithm for maximum flow.
- push_
relabel_ max_ flow_ full - Push-relabel algorithm returning full flow result.