Skip to content

@graphty/algorithms / index / greedyBipartiteMatching

Function: greedyBipartiteMatching() ​

greedyBipartiteMatching(s, options?): BipartiteMatchingResult

Defined in: indexed/matching.ts:246

Greedy maximal bipartite matching: every left node in index order takes its first unmatched right neighbour in row order (the lowest index; out-arcs before in-arcs). The size depends on those orders, so it can differ from the legacy function, which visits left nodes in its colouring BFS order and neighbours in insertion order; it is at least half the maximum.

Parameters ​

s ​

GraphSnapshot

The snapshot

options? ​

BipartiteMatchingOptions = {}

The two sides, and which arcs to follow on a directed snapshot

Returns ​

BipartiteMatchingResult

The partner of every matched left node and the number of pairs

Throws ​

Error when the sides are inferred and the graph is not bipartite