FlowNetwork
public struct FlowNetwork<Node: Hashable, Weight: Numeric & Comparable>:
WeightedGraphProtocol,
DirectedGraphProtocol
Directed graph with several properties:
- Each edge has a capacity for flow
- A
source
node, which only emanates flow outward - A
sink
node, which only receives flow
-
Declaration
Swift
public var weights: [Edge : Weight]
-
Declaration
Swift
public var nodes: Set<Node>
-
Undocumented
Declaration
Swift
public var source: Node
-
Undocumented
Declaration
Swift
public var sink: Node
-
Declaration
Swift
public typealias Edge = OrderedPair<Node>
-
Declaration
Swift
public var minimumCut: (Set<Node>, Set<Node>) { get }
Return Value
A minimum cut with nodes included on the
sink
side in case of a tiebreak (in- and out- edges saturated).