Bipartite graphs and odd cycles as undirected connectivity #
An undirected graph instance (Cslib.Complexity.UGraphInstance) is a simple graph on Fin n,
given by a symmetric adjacency matrix with zero diagonal. It belongs to
Cslib.Complexity.Bipartite when its graph is 2-colourable (SimpleGraph.IsBipartite).
Non-bipartiteness becomes undirected s–t connectivity through the double cover G′ of
Goldreich, Exercise 5.16, whose vertices are the pairs (v, b) of a vertex and a
side, with an edge between (u, b) and (v, !b) for every edge {u, v}. A vertex x lies on an
odd closed walk exactly when (x, 0) and (x, 1) are connected in G′. The instance
Cslib.Complexity.Bipartite.oddCycleInstance G takes one copy of G′ for every vertex x, a
source joined to (x, 0) in copy x and a target joined to (x, 1) in copy x. The copies are
disjoint, so the source reaches the target exactly when some vertex lies on an odd closed walk,
that is, when G is not bipartite (Cslib.Complexity.Bipartite.oddCycleInstance_mem_iff). This
turns the disjunction over x of Goldreich's guideline into a single query.
The vertices of the instance are numbered so that a counter program can decode them: the source
is 0, the target 1, and the vertex (v, b) of copy x is
Cslib.Complexity.Bipartite.copyVertex n x v b = 2 + 2 n x + 2 v + b.
Main definitions #
Cslib.Complexity.Bipartite: the bipartite instances.Cslib.Complexity.Bipartite.oddCycleInstance: the copies of the double cover, as an instance of undirected connectivity.
Main results #
Cslib.Complexity.Bipartite.oddCycleInstance_mem_iff: the source reaches the target exactly when the graph is not bipartite.
References #
Bipartite graphs: the instances whose graph is 2-colourable.
The numbering of the copies of the double cover #
The number of vertices: two copies of each of the n vertices in each of the n copies, a
source and a target.
The vertex (v, b) of the copy x.
The vertex of the graph that a vertex numbered at least 2 stands for.
The instance #
The edges of the copies of the double cover, the source and the target, on natural numbers:
within a copy, (u, b) and (v, !b) are joined when u and v are; the source 0 is joined to
(x, 0) and the target 1 to (x, 1) in the copy x.
The copies of the double cover, with the source 0 and the target 1, as an instance of
undirected connectivity.
The vertex (v, b) of the copy x, as a vertex of the instance.
Within a numbered copy, adjacency is exactly Mathlib's bipartite double cover. The arithmetic representation is retained for the counter-program writer.
A walk of length ℓ from v to w gives a path from (v, b) to (w, b xor parity ℓ) in
every copy.
The source reaches the target exactly when the graph is not bipartite.