GraphTheory
BipartiteMatching
find maximum matching for bipartite graph
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
BipartiteMatching(G,opts)
G
-
undirected bipartite graph
opts
(optional) one or more options as specified below
output=list or one of edges, size, or weight.
A list of one or more of the symbols edges, size, and weight, or one of the symbols edges, size, or weight. This determines what is returned by BipartiteMatching. The output is an expression sequence with the corresponding values.
BipartiteMatching(G) returns a maximum matching for a bipartite graph G.
If W is unweighted, the default output is an expression sequence whose first element is the size of a maximum matching and whose second element is the matching itself.
If W is weighted, the default output is an expression sequence whose first element is the weight of a maximum matching of minimum weight and whose second element is the matching itself.
Perform a simple bipartite matching on an unweighted bipartite graph.
with⁡GraphTheory:
G≔Graph⁡1,2,2,3,3,4,3,8,4,5,5,6,6,7
G≔Graph 1: an undirected graph with 8 vertices and 7 edge(s)
B≔BipartiteMatching⁡G
B≔4,1,2,3,8,4,5,6,7
Draw the matching in red
HighlightEdges⁡G,B2
DrawGraph⁡G,style=bipartite
Compute a minimum-weight maximum matching on a weighted bipartite graph.
M≔Matrix⁡4,4,8,5,2,18,20,24,11,19,25,14,18,15,8,10,14,12
M≔8521820241119251418158101412
WM≔Matrix⁡4,M|M%T,Matrix⁡4
WM≔0000820258000052414100000211181400001819151285218000020241119000025141815000081014120000
G≔Graph⁡WM
G≔Graph 2: an undirected weighted graph with 8 vertices and 16 edge(s)
B≔39,1,8,2,5,3,6,4,7
The GraphTheory[BipartiteMatching] command was updated in Maple 2021.
The G parameter was updated in Maple 2021.
The output option was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
DrawGraph
HighlightEdges
IsBipartite
Download Help Document