BitGraph.Algorithm.Matching.Kuhn (bitgraph v0.4.1)
Maximum Matching for bipartite graph (Kuhn algorithm). Implementation mostly follows https://cp-algorithms.com/graph/kuhn_maximum_bipartite_matching.html
Summary
Functions
Replaces vertex labels with vertex indices. The modified options will be used by the implementation (run/2)
Kuhn algorithm (operating on vertex indices)
graph - bipartite graph.
Functions
@spec preprocess(BitGraph.t(), Keyword.t()) :: Keyword.t()
Replaces vertex labels with vertex indices. The modified options will be used by the implementation (run/2)
@spec run(BitGraph.t(), Keyword.t()) :: %{matching: Map.t(), free: MapSet.t()} | nil
Kuhn algorithm (operating on vertex indices)
graph - bipartite graph.
Options:
- :left_partition (mandatory) - list or set of vertices that represent one of the two paartition of
graph. - :fixed_matching (optional) - The edges that have to be in matching. This is a
left_vertex => right vertex, whereleft_vertexis a vertex fromleft_partition - :required_size (optional) - The required size of maximum matching. If not reached, algorithm returns
nil
Output: map with keys
- :matching - map of left_vertex => right_vertex
- :free - unmatched vertices from right partition
@spec run(BitGraph.t(), MapSet | list(), Keyword.t()) :: %{matching: Map.t(), free: MapSet.t()} | nil