algraph-0.7.0.0: Graph library using adjacency list representation
CopyrightThodoris Papakonstantinou 2017-2026
LicenseLGPL-3
Maintainerdev@tpapak.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

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 source and sink vertex
  • Edge Capacities (mapping each edge to a non-negative Rational)
  • 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

Network type

data Network Source #

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

Instances

Instances details
Show Network Source # 
Instance details

Defined in Data.Graph.AdjacencyList.Network

Eq Network Source # 
Instance details

Defined in Data.Graph.AdjacencyList.Network

Methods

(==) :: Network -> Network -> Bool #

(/=) :: Network -> Network -> Bool #

Type aliases

type Capacity = Rational Source #

Edge capacity. Uses Rational for exact arithmetic, ensuring the Tide algorithm terminates correctly for arbitrary capacity values.

type Capacities = Map Edge Capacity Source #

Map from edges to their capacities.

type Flow = Capacity Source #

Edge flow. Same type as Capacity since flow values are rational.

Utilities

uniformCapacities :: Graph -> Capacities Source #

Set all edge capacities to 1 (unit capacity network).