haccepted-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageHaskell2010

Dinic

Description

Dinic's algorithm, or Dinitz's algorithm

An algorithm to find the maximum flow in a flow network.

Sources:

Synopsis

Documentation

data FlowEdge Source #

Constructors

FlowEdge 

Fields

Instances

Instances details
Eq FlowEdge Source # 
Instance details

Defined in Dinic

Show FlowEdge Source # 
Instance details

Defined in Dinic

NFData FlowEdge Source # 
Instance details

Defined in Dinic

Methods

rnf :: FlowEdge -> () #

data FlowResult Source #

Constructors

FlowResult 

Fields

data ToEdge Source #

Constructors

ToEdge 

Fields

type Flow = Int Source #

dinic :: Bounds -> [FlowEdge] -> Vertex -> Vertex -> FlowResult Source #

Runs Dinic's algorithm on the graph made up of the given FlowEdges. Returns a FlowResult, describing a max flow configuration with 1. the max flow value 2. flow values of the edges in the order in which they were given 3. a list of Bools for each edge indicating whether the edge is in a min-cut O(V^2 E) in the general case. O(min(V^(23), E^(12)) E) for unit capacity graphs. O(V^(1/2) E) for unit networks, such as in maximum bipartite matching.