Skip to content

@graphty/algorithms / index / bipartiteFlowNetwork

Function: bipartiteFlowNetwork() ​

bipartiteFlowNetwork(left, right, edges): BipartiteFlowNetwork

Defined in: indexed/flow.ts:544

The unit-capacity flow network whose maximum flow is a maximum bipartite matching: a source with an edge to every left node, every given left-right edge, and an edge from every right node to a sink. Nodes are numbered source, left nodes, left endpoints of edges not already listed, right nodes, right endpoints not already listed, sink; a repeated edge is kept once.

Parameters ​

left ​

readonly NodeId[]

The left side's node ids

readonly NodeId[]

The right side's node ids

edges ​

readonly readonly [NodeId, NodeId][]

Left-to-right edges as [left id, right id]

Returns ​

BipartiteFlowNetwork

The network and the indices of its source and sink

Throws ​

RangeError when a given id is "__source__" or "__sink__"