Bölüm 4.4 · Simülatör

Network Flow Simulator

← Bölüm 4.4
sourcesinkaugmenting pathmin cut

Ready.

 

 

Network Flow Simulator

Compare Ford-Fulkerson and Edmonds-Karp on the same directed capacity network.

How to use

  • Set the number of nodes (4–12) and press New Graph. Node 0 is the source, the last node is the sink; capacities are 5–15 and every edge points from left to right.
  • Drag nodes to rearrange the drawing (not while an algorithm is running).
  • Run Ford-Fulkerson or Edmonds-Karp; each run starts again from zero flow, so both methods can be compared on the same network. Cancel stops the animation; Speed changes its pace.
  • Each edge is labelled flow/capacity and drawn thicker as its flow grows. The current augmenting path is highlighted; a dashed segment means the path uses that edge backwards (it cancels flow).
  • When the run ends, nodes still reachable from the source in the residual graph are tinted and the edges of the minimum cut are marked: their capacities add up to the maximum flow.

Ford-Fulkerson

Repeatedly finds any augmenting path in the residual graph. This demo uses depth-first search to choose that path. With integer capacities it needs at most |f*| augmentations, i.e. O(E · |f*|) time.

Edmonds-Karp

Uses breadth-first search to choose the shortest augmenting path in number of edges, giving a polynomial O(VE²) bound.

Max-flow min-cut theorem

The value of a maximum flow equals the capacity of a minimum s–t cut. The cut shown after a run is found from the final residual graph.