Bipartite graphs #
This file proves results about bipartite simple graphs, including several double-counting arguments.
Main definitions #
SimpleGraph.IsBipartiteWith G s t
is the condition that a simple graphG
is bipartite in setss
,t
, that is,s
andt
are disjoint and verticesv
,w
being adjacent inG
implies thatv ∈ s
andw ∈ t
, orv ∈ s
andw ∈ t
.Note that in this implementation, if
G.IsBipartiteWith s t
,s ∪ t
need not cover the vertices ofG
, insteads ∪ t
is only required to cover the support ofG
, that is, the vertices that form edges inG
. This definition is equivalent to the expected definition. Ifs
andt
do not cover all the vertices, one recovers a covering of all the vertices by unioning the missing vertices(s ∪ t)ᶜ
to eithers
ort
.SimpleGraph.isBipartiteWith_sum_degrees_eq
is the proof that ifG.IsBipartiteWith s t
, then the sum of the degrees of the vertices ins
is equal to the sum of the degrees of the vertices int
.SimpleGraph.isBipartiteWith_sum_degrees_eq_card_edges
is the proof that ifG.IsBipartiteWith s t
, then sum of the degrees of the vertices ins
is equal to the number of edges inG
.See
SimpleGraph.sum_degrees_eq_twice_card_edges
for 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
.
TODO #
Define
G.IsBipartite := G.Colorable 2
and proveG.IsBipartite
iff there exist setss t : Set V
such thatG.IsBipartiteWith s t
.Prove that
G.IsBipartite
iffG
does 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".