maximal_extendability

maximal_extendability#

graph_tool.structure.maximal_extendability(g)[git][source]#

Return the maximal extendability of a bipartite graph.

Parameters:
gGraph

Connected bipartite graph with a perfect matching.

Returns:
kint

The largest \(k\) such that every matching of \(k\) edges extends to a perfect matching.

See also

maximum_cardinality_matching

Maximum matching

graph_tool.flow.disjoint_paths

Disjoint paths between two vertices

is_bipartite

Test for bipartite graphs

Notes

A connected bipartite graph with a perfect matching is \(k\)-extendable if every matching of \(k\) edges (a set of \(k\) edges no two of which share an endpoint) is contained in a perfect matching (one that covers every vertex), and its maximal extendability is the largest such \(k\). To compute it, a perfect matching is oriented from the second side to the first, and the other edges from the first side to the second; the extendability is the smallest number of vertex-disjoint paths in this residual graph from a vertex of the first side to one of the second [lakhal-polynomial-1998], found by augmenting paths (as with disjoint_paths()) for every pair, so that the time is \(O(V^2 E k)\). A ValueError is raised if the graph is not connected or bipartite, has no perfect matching, or its residual graph is not strongly connected (in which case the extendability is zero).

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.

References

[lakhal-polynomial-1998]

Jamel Lakhal and Louis Litzler, “A polynomial algorithm for the extendability problem in bipartite graphs”, Information Processing Letters 65, 11-16 (1998), DOI: 10.1016/S0020-0190(97)00177-4 [sci-hub, @tor]

Examples

>>> g = gt.lattice([2, 2, 2])
>>> print(gt.maximal_extendability(g))
2