| Copyright | Thodoris Papakonstantinou 2017-2026 |
|---|---|
| License | LGPL-3 |
| Maintainer | dev@tpapak.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.Graph.AdjacencyList.Network
Description
Defines the Network type used as input to the Tide max-flow algorithm.
A Network consists of:
- A directed
Graph - A distinguished
sourceandsinkvertex - Edge
Capacities(mapping each edge to a non-negativeRational) - Edge flows (initially zero, filled in by the solver)
Capacities use Rational for exact arithmetic — the Tide algorithm
terminates correctly for arbitrary rational capacities. For integer-only
workloads, see the Rust implementation tide-maxflow which uses i64.
Synopsis
- data Network = Network {
- graph :: !Graph
- source :: Vertex
- sink :: Vertex
- capacities :: Capacities
- flow :: Capacities
- type Capacity = Rational
- type Capacities = Map Edge Capacity
- type Flow = Capacity
- uniformCapacities :: Graph -> Capacities
Network type
A flow network: a directed graph with a source, sink, edge capacities, and edge flows.
Construct a Network with zero initial flows and pass it to
pushRelabel to compute the
maximum flow.
Constructors
| Network | |
Fields
| |
Type aliases
type Capacity = Rational Source #
Edge capacity. Uses Rational for exact arithmetic, ensuring the
Tide algorithm terminates correctly for arbitrary capacity values.
Utilities
uniformCapacities :: Graph -> Capacities Source #
Set all edge capacities to 1 (unit capacity network).