rustworkx.is_maximal_matching#
- 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.
Note
This is not checking for a maximum (globally optimal) matching, but a maximal (locally optimal) matching.
- Parameters:
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.
- Returns:
Whether the provided matching is a valid matching and whether it is maximal or not.
- Return type:
bool