This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.


is_maximal_matching(graph, matching, /)#

Check if a matching is a maximal (not maximum) matching for a graph

A maximal matching in a graph is a matching in which adding any edge would cause the set to no longer be a valid matching.


This is not checking for a maximum (globally optimal) matching, but a maximal (locally optimal) matching.

  • graph (PyDiGraph) – The graph to check if the matching is maximal for.

  • matching (set) – A set of node index tuples for each edge in the matching.


Whether the provided matching is a valid matching and whether it is maximal or not.

Return type: