I have found the Perfect Matching's definition in Wiki.
A perfect matching (a.k.a. 1-factor) is a matching which matches all vertices of the graph. That is, every vertex of the graph is incident to exactly one edge of the matching.
Or another samilar definition, Near-Perfect Matching, as follows:
A near-perfect matching is one in which exactly one vertex is unmatched. This can only occur when the graph has an odd number of vertices, and such a matching must be maximum.
I can give some example to illustrate it. In a simple graph
Graph[{1 <-> 4, 1 <-> 5, 1 <-> 6, 2 <-> 4, 2 <-> 5, 2 <-> 6, 3 <-> 6},
VertexLabels -> "Name", GraphLayout -> "BipartiteEmbedding"]
We can judge it by eye, such as the 3-6, 2-5, 1-4
or 3-6, 2-4, 1-5
is the Perfect Matching
. But in some complicated case it will be harder to judge. For example:
Graph[{1 <-> 16, 1 <-> 17, 1 <-> 18, 1 <-> 19, 1 <-> 20, 1 <-> 21,
2 <-> 16, 2 <-> 17, 2 <-> 18, 2 <-> 22, 2 <-> 23, 2 <-> 24,
3 <-> 16, 3 <-> 19, 3 <-> 20, 3 <-> 22, 3 <-> 23, 3 <-> 25,
4 <-> 17, 4 <-> 19, 4 <-> 21, 4 <-> 22, 4 <-> 24, 4 <-> 25,
5 <-> 18, 5 <-> 20, 5 <-> 21, 5 <-> 23, 5 <-> 24, 5 <-> 25,
6 <-> 16, 6 <-> 17, 6 <-> 18, 6 <-> 26, 6 <-> 27, 6 <-> 28,
7 <-> 16, 7 <-> 19, 7 <-> 20, 7 <-> 26, 7 <-> 27, 7 <-> 29,
8 <-> 17, 8 <-> 19, 8 <-> 21, 8 <-> 26, 8 <-> 28, 8 <-> 29,
9 <-> 18, 9 <-> 20, 9 <-> 21, 9 <-> 27, 9 <-> 28, 9 <-> 29,
10 <-> 16, 10 <-> 22, 10 <-> 23, 10 <-> 26, 10 <-> 27, 10 <-> 30,
11 <-> 17, 11 <-> 22, 11 <-> 24, 11 <-> 26, 11 <-> 28, 11 <-> 30,
12 <-> 18, 12 <-> 23, 12 <-> 24, 12 <-> 27, 12 <-> 28, 12 <-> 30,
13 <-> 19, 13 <-> 22, 13 <-> 25, 13 <-> 26, 13 <-> 29, 13 <-> 30,
14 <-> 20, 14 <-> 23, 14 <-> 25, 14 <-> 27, 14 <-> 29, 14 <-> 30,
15 <-> 21, 15 <-> 24, 15 <-> 25, 15 <-> 28, 15 <-> 29, 15 <-> 30},
GraphLayout -> "BipartiteEmbedding"]
I'm dizzy now. We can use GraphData["PerfectMatching"]
to produce some graph with PerfectMatching
to give it a try.
Question:
How to get all possible Perfect Matching or Near-Perfect Matching using Mathematica
?
FindIndependentEdgeSet[ ]
...it finds ONE $\endgroup$