Bipartite graphs #
This file proves results about bipartite simple graphs, including several double-counting arguments.
Main definitions #
SimpleGraph.IsBipartiteWith G s tis the condition that a simple graphGis bipartite in setss,t, that is,sandtare disjoint and verticesv,wbeing adjacent inGimplies thatv ∈ sandw ∈ t, orv ∈ sandw ∈ t.Note that in this implementation, if
G.IsBipartiteWith s t,s ∪ tneed not cover the vertices ofG, insteads ∪ tis only required to cover the support ofG, that is, the vertices that form edges inG. This definition is equivalent to the expected definition. Ifsandtdo not cover all the vertices, one recovers a covering of all the vertices by unioning the missing vertices(s ∪ t)ᶜto eithersort.SimpleGraph.IsBipartite: Predicate for a simple graph to be bipartite.G.IsBipartiteis defined as an abbreviation forG.Colorable 2.SimpleGraph.isBipartite_iff_exists_isBipartiteWithis the proof thatG.IsBipartiteiffG.IsBipartiteWith s t.SimpleGraph.isBipartiteWith_sum_degrees_eqis the proof that ifG.IsBipartiteWith s t, then the sum of the degrees of the vertices insis equal to the sum of the degrees of the vertices int.SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edgesis the proof that ifG.IsBipartiteWith s t, then sum of the degrees of the vertices insis equal to the number of edges inG.See
SimpleGraph.sum_degrees_eq_twice_card_edgesfor the general version, andSimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges'for the version from the "right".
Implementation notes #
For the formulation of double-counting arguments where a bipartite graph is considered as a
relation r : α → β → Prop, see Mathlib/Combinatorics/Enumerative/DoubleCounting.lean.
TODO #
- Prove that
G.IsBipartiteiffGdoes not contain an odd cycle. I.e.,G.IsBipartite ↔ ∀ n, (cycleGraph (2*n+1)).Free G.
G is bipartite in sets s and t iff s and t are disjoint and if vertices v and w
are adjacent in G then v ∈ s and w ∈ t, or v ∈ t and w ∈ s.
- disjoint : Disjoint s t
Instances For
If G.IsBipartiteWith s t and v ∈ s, then if v is adjacent to w in G then w ∈ t.
If G.IsBipartiteWith s t and v ∈ s, then the neighbor set of v is the set of vertices in
t adjacent to v in G.
If G.IsBipartiteWith s t and v ∈ s, then the neighbor set of v is a subset of t.
If G.IsBipartiteWith s t and v ∈ s, then the neighbor set of v is disjoint to s.
If G.IsBipartiteWith s t and w ∈ t, then if v is adjacent to w in G then v ∈ s.
If G.IsBipartiteWith s t and w ∈ t, then the neighbor set of w is the set of vertices in
s adjacent to w in G.
If G.IsBipartiteWith s t and w ∈ t, then the neighbor set of w is a subset of s.
If G.IsBipartiteWith s t, then the support of G is a subset of s ∪ t.
If G.IsBipartiteWith s t and w ∈ t, then the neighbor set of w is disjoint to t.
If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is the set of vertices
in s adjacent to v in G.
If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is the set of vertices
"above" v according to the adjacency relation of G.
If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is a subset of s.
If G.IsBipartiteWith s t and v ∈ s, then the neighbor finset of v is disjoint to s.
If G.IsBipartiteWith s t and v ∈ s, then the degree of v in G is at most the size of
t.
If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is the set of vertices
in s adjacent to w in G.
If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is the set of vertices
"below" w according to the adjacency relation of G.
If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is a subset of s.
If G.IsBipartiteWith s t and w ∈ t, then the neighbor finset of w is disjoint to t.
If G.IsBipartiteWith s t and w ∈ t, then the degree of w in G is at most the size of
s.
If G.IsBipartiteWith s t, then the sum of the degrees of vertices in s is equal to the sum
of the degrees of vertices in t.
See Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow.
The degree-sum formula for bipartite graphs, summing over the "left" part.
See SimpleGraph.sum_degrees_eq_twice_card_edges for the general version, and
SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges' for the version from the "right".
The degree-sum formula for bipartite graphs, summing over the "right" part.
See SimpleGraph.sum_degrees_eq_twice_card_edges for the general version, and
SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges for the version from the "left".
The predicate for a simple graph to be bipartite.
Equations
- G.IsBipartite = G.Colorable 2
Instances For
If a simple graph G is bipartite, then there exist disjoint sets s and t
such that all edges in G connect a vertex in s to a vertex in t.
If a simple graph G has a bipartition, then it is bipartite.
G.IsBipartite if and only if G.IsBipartiteWith s t.