Matchings #
A matching for a simple graph is a set of disjoint pairs of adjacent vertices, and the set of all the vertices in a matching is called its support (and sometimes the vertices in the support are said to be saturated by the matching). A perfect matching is a matching whose support contains every vertex of the graph.
In this module, we represent a matching as a subgraph whose vertices are each incident to at most one edge, and the edges of the subgraph represent the paired vertices.
Main definitions #
SimpleGraph.Subgraph.IsMatching:M.IsMatchingmeans thatMis a matching of its underlying graph.SimpleGraph.Subgraph.IsPerfectMatchingdefines when a subgraphMof a simple graph is a perfect matching, denotedM.IsPerfectMatching.SimpleGraph.IsMatchingFreemeans that a graphGhas no perfect matchings.SimpleGraph.IsCyclesmeans that a graph consists of cycles (including cycles of length 0, also known as isolated vertices)SimpleGraph.IsAlternatingmeans that edges in a graphGare alternatingly included and not included in some other graphG'
TODO #
Define an
otherfunction and prove useful results about it (https://leanprover.zulipchat.com/#narrow/stream/252551-graph-theory/topic/matchings/near/266205863)Provide a bicoloring for matchings (https://leanprover.zulipchat.com/#narrow/stream/252551-graph-theory/topic/matchings/near/265495120)
Tutte's Theorem
Hall's Marriage Theorem (see
Mathlib/Combinatorics/Hall/Basic.lean)
The subgraph M of G is a matching if every vertex of M is incident to exactly one edge in M.
We say that the vertices in M.support are matched or saturated.
Instances For
Given a vertex, returns the unique edge of the matching it is incident to.
Instances For
The subgraph M of G is a perfect matching on G if it's a matching and every vertex G is
matched.
Equations
- M.IsPerfectMatching = (M.IsMatching ∧ M.IsSpanning)
Instances For
A graph is matching free if it has no perfect matching. It does not make much sense to consider a graph being free of just matchings, because any non-trivial graph has those.
Equations
- G.IsMatchingFree = ∀ (M : G.Subgraph), ¬M.IsPerfectMatching
Instances For
A graph G consists of a set of cycles, if each vertex is either isolated or connected to
exactly two vertices. This is used to create new matchings by taking the symmDiff with cycles.
The definition of symmDiff that makes sense is the one for SimpleGraph. The symmDiff
for SimpleGraph.Subgraph deriving from the lattice structure also affects the vertices included,
which we do not want in this case. This is why this property is defined for SimpleGraph, rather
than SimpleGraph.Subgraph.
Equations
- G.IsCycles = ∀ ⦃v : V⦄, (G.neighborSet v).Nonempty → (G.neighborSet v).ncard = 2
Instances For
Given a vertex with one edge in a graph of cycles this gives the other edge incident to the same vertex.
Alias of SimpleGraph.IsCycles.toSimpleGraph.
A graph G is alternating with respect to some other graph G', if exactly every other edge in
G is in G'. Note that the degree of each vertex needs to be at most 2 for this to be
possible. This property is used to create new matchings using symmDiff.
The definition of symmDiff that makes sense is the one for SimpleGraph. The symmDiff
for SimpleGraph.Subgraph deriving from the lattice structure also affects the vertices included,
which we do not want in this case. This is why this property, just like IsCycles, is defined
for SimpleGraph rather than SimpleGraph.Subgraph.