Documentation

CslibFrontier.Computability.PropertyTesting.DenseGraph.Bipartite

Testing bipartiteness in the dense graph model #

Bipartiteness is one-sided testable in the dense graph model with a number of queries polynomial in 1 / ε and independent of the number of vertices Goldreich, Goldwasser and Ron; see also Goldreich, Chapter 8.

The tester bipartiteRun n' s m on Fin (n' + 1) samples s uniform vertices u and m uniform pairs of vertices (x k, y k), all independent. It queries the m (2 s + 1) pairs (x k, u i), (y k, u i) and (x k, y k) and accepts when there is a proper 2-colouring of the sample positions (bipAccept): a colour for each index i of u and for each index k of x and of y, with different colours at the two ends of every observed edge. A vertex that occurs at several positions may receive different colours, so this is laxer than asking that the observed subgraph be bipartite: with s = 0 and m = 3 on the triangle, the tester can observe all three edges and still accept. A bipartite graph is always accepted, since a proper 2-colouring of the graph induces one of the positions.

Source mapping #

The query pattern, with a vertex sample U and pairs each checked against U and against each other, is that of Goldreich, Goldwasser and Ron, §6.1.1, p. 683. The soundness argument follows their §6.1 (Theorem 6.1.2, Claims 6.1.4 and 6.1.6, pp. 679–683): a 2-partition of U forces a partition of the vertices with a neighbour in U, and a far graph leaves many violating pairs under every such forced partition. Their factor-two distance convention is §5.1, pp. 675–676. The open book draft of April 26, 2017 (§8.3.1, Algorithm 8.7 and Lemma 8.8, pp. 174–177; the published book is Goldreich, Chapter 8) presents the same high-degree coverage argument.

Adaptation in the coverage step. GGR take |U| = O(log (1 / (ε δ)) / ε) so that, with high probability, U dominates all but few high-degree vertices. The result is O(log² (1 / (ε δ)) / ε³) queries. Here the coverage step is replaced by an expectation bound. The expected degree mass of the vertices with no neighbour in U is at most n² / (s + 1) (sum_uncoveredDegree_le, from d (n - d) ^ s ≤ n ^ (s + 1) / (s + 1)). Markov's inequality then suffices at constant confidence, so s = ⌈12 / ε⌉ works and the logarithmic factors disappear. This refinement of the analysis is ours; we do not know of an exact source for it and claim no novelty for it. It gives no asymptotic improvement over the Õ(ε⁻²) bound of Alon and Krivelevich.

Proof outline #

A colouring χ of the sampled vertices forces a colour on every vertex with a sampled neighbour, the colour opposite to that neighbour's. If the tester accepts, some χ leaves every sampled pair (x k, y k) outside the set of bad pairs: edges between two vertices with sampled neighbours that receive the same forced colour. Extending the forced colouring arbitrarily, an ε-far graph has more than 2 ε n² ordered monochromatic adjacent pairs, and those not bad have an endpoint without a sampled neighbour. The expected degree mass of the vertices without a sampled neighbour is at most n² / (s + 1), so by Markov's inequality it exceeds ε n² / 2 with probability at most 2 / (ε (s + 1)). Otherwise every colouring of the sample has more than ε n² ordered bad pairs, and the m independent pairs all avoid them with probability at most (1 - ε) ^ m. A union bound over the 2 ^ s colourings gives

acceptProb ≤ 2 / (ε (s + 1)) + 2 ^ s (1 - ε) ^ m ≤ 1 / 6 + 1 / 8 < 1 / 3

when 12 ≤ ε s and s + 3 ≤ ε m. With s = ⌈12 / ε⌉ and m = ⌈(s + 3) / ε⌉ the tester asks m (2 s + 1) ≤ 459 / ε³ queries for ε ≤ 1. Distances are those of IsFar, relative to n² vertex pairs; Goldreich's distance ε is IsFar G P (ε / 2) here.

This file bounds queries only; it makes no claim about running time. The O(ε⁻³) bound is not optimal: a uniform sample of Õ(1 / ε) vertices already induces a non-bipartite subgraph of an ε-far graph with high probability, which gives Õ(ε⁻²) queries Alon and Krivelevich.

Main definitions #

Main results #

References #

The decision rule #

def Cslib.DenseGraphTesting.bipAccept {s m : ℕ} (a b : Fin m → Fin s → Bool) (c : Fin m → Bool) :

The decision rule of the bipartiteness tester. The bits a k i, b k i and c k report whether x k ~ u i, y k ~ u i and x k ~ y k; accept when the sample positions admit a proper 2-colouring: χ of the positions i, ξ and ζ of the positions k of x and of y. Colours are attached to positions, not vertices, so a repeated vertex may receive two colours.

theorem Cslib.DenseGraphTesting.bipAccept_eq_true_iff {s m : ℕ} (a b : Fin m → Fin s → Bool) (c : Fin m → Bool) :
bipAccept a b c = true ↔ ∃ (χ : Fin s → Bool) (ξ : Fin m → Bool) (ζ : Fin m → Bool), (∀ (k : Fin m) (i : Fin s), a k i = true → ξ k ≠ χ i) ∧ (∀ (k : Fin m) (i : Fin s), b k i = true → ζ k ≠ χ i) ∧ ∀ (k : Fin m), c k = true → ξ k ≠ ζ k

Monochromatic pairs #

theorem Cslib.DenseGraphTesting.IsFar.two_mul_lt_sum_monochromatic {V : Type u_1} [Fintype V] {G : SimpleGraph V} [DecidableRel G.Adj] {ε : ℝ} (h : IsFar G (fun (H : SimpleGraph V) => H.IsBipartite) ε) (f : V → Bool) :
2 * (ε * ↑(Fintype.card V ^ 2)) < ∑ v : V, ∑ w : V, if G.Adj v w ∧ f v = f w then 1 else 0

A graph ε-far from bipartite has more than 2 ε n² ordered adjacent pairs of the same colour under every 2-colouring f: deleting them leaves a bipartite graph.

Forced colourings #

Coverage #

Counting accepted samples #

The tester #

One run of the bipartiteness tester on Fin (n' + 1): sample s uniform vertices u and m uniform pairs (x k, y k), query (x k, u i), (y k, u i) and (x k, y k), and accept when the sample positions admit a proper 2-colouring (bipAccept).

The bipartiteness tester with s sampled vertices and m sampled pairs. The graph on no vertices is accepted without queries.

A run asks m (2 s + 1) queries.

The tester asks at most m (2 s + 1) queries.

theorem Cslib.DenseGraphTesting.acceptProb_bipartiteRun (n' s m : ℕ) (G : SimpleGraph (Fin (n' + 1))) [DecidableRel G.Adj] :
acceptProb (bipartiteRun n' s m) G = (∑ u : Fin s → Fin (n' + 1), ∑ x : Fin m → Fin (n' + 1), ∑ y : Fin m → Fin (n' + 1), if (bipAccept (fun (k : Fin m) (i : Fin s) => decide (G.Adj (x k) (u i))) (fun (k : Fin m) (i : Fin s) => decide (G.Adj (y k) (u i))) fun (k : Fin m) => decide (G.Adj (x k) (y k))) = true then 1 else 0) / ((↑n' + 1) ^ s * (↑n' + 1) ^ m * (↑n' + 1) ^ m)

The acceptance probability of a run is the fraction of accepted samples.

Completeness. A bipartite graph is accepted with probability one.

theorem Cslib.DenseGraphTesting.acceptProb_bipartiteTester_le_one_third {n s m : ℕ} {ε : ℝ} (hs : 12 ≤ ε * ↑s) (hm : ↑s + 3 ≤ ε * ↑m) {G : SimpleGraph (Fin n)} (hG : IsFar G (fun (H : SimpleGraph (Fin n)) => H.IsBipartite) ε) :

Soundness. If 12 ≤ ε s and s + 3 ≤ ε m, a graph ε-far from bipartite is accepted with probability at most 1 / 3.

theorem Cslib.DenseGraphTesting.isOneSidedTester_bipartiteTester {n s m : ℕ} {ε : ℝ} (hs : 12 ≤ ε * ↑s) (hm : ↑s + 3 ≤ ε * ↑m) :
IsOneSidedTester (bipartiteTester n s m) (fun (G : SimpleGraph (Fin n)) => G.IsBipartite) ε (m * (2 * s + 1))

Bipartiteness is testable. If 12 ≤ ε s and s + 3 ≤ ε m, the tester with s sampled vertices and m sampled pairs is a one-sided tester for bipartiteness with proximity ε and m (2 s + 1) queries.

theorem Cslib.DenseGraphTesting.oneSidedTestable_isBipartite :
OneSidedTestable (fun (x : ℕ) (G : SimpleGraph (Fin x)) => G.IsBipartite) fun (ε : ℝ) => ⌈(↑⌈12 / ε⌉₊ + 3) / ε⌉₊ * (2 * ⌈12 / ε⌉₊ + 1)

Bipartiteness is one-sided testable with a number of queries depending only on the proximity: ⌈(⌈12 / ε⌉ + 3) / ε⌉ (2 ⌈12 / ε⌉ + 1) queries, which is at most 459 / ε³ for ε ≤ 1 (bipartiteQueryBound_le).

theorem Cslib.DenseGraphTesting.bipartiteQueryBound_le {ε : ℝ} (hε : 0 < ε) (hε₁ : ε ≤ 1) :
↑(⌈(↑⌈12 / ε⌉₊ + 3) / ε⌉₊ * (2 * ⌈12 / ε⌉₊ + 1)) ≤ 459 / ε ^ 3

The query bound of oneSidedTestable_isBipartite is O(ε⁻³): at most 459 / ε³ for 0 < ε ≤ 1.