The depth-first search of Krivelevich and Sudakov (EPI-3) #
Krivelevich and Sudakov (The phase transition in random graphs: a simple proof, Random
Structures & Algorithms 43 (2013), arXiv:1201.6529, Section 2) explore a graph by depth-first
search, maintaining three sets: S (exploration complete), U (a stack) and T (unvisited).
While U is non-empty, the algorithm queries the pairs between the last vertex v of U and the
vertices of T; a positive answer for {v, u} moves u from T to U, and if no pair is left,
v moves to S. If U is empty, a vertex of T is pushed into U, starting a new epoch
(one per connected component). Once U = T = ∅, the remaining pairs are queried (the paper's
completion phase), so that every pair is queried exactly once.
The search is fed with answers: ofAnswers V l is the state reached with the answers l (in
order), stopped just before the next query pending. On the edge coins ω, the answers are
queryAnswers (nextQuery e₀) ω t; the search then explores perc ⊤ ω
(mem_found_iff_of_queryAnswers), and by the principle of deferred decisions the answers are i.i.d.
Bernoulli(p) (fresh_nextQuery with prob_queryAnswers).
The paper scans T along a fixed order σ; any deterministic choice works, and we use pick.
Structure of the proofs: State.Inv is an invariant preserved by every move (Inv.move) and
answer (Inv.answer); settle reaches a state where a query is due (move_settle), because the
potential 2 |S| + |U| ≤ 2 |V| increases with every effective move; a settle starts at most one
epoch (epochs_settle_le). The extra field pushes counts the vertices pushed by positive answers.
The properties of the search used in the paper:
- each query is a new pair (
fresh_nextQuery,card_queried_ofAnswers); - all pairs between
SandThave been queried and answered negatively (queried_of_mem_done_of_mem_unvisited); Uspans a path (stack_chain_ofAnswers);|U| ≤ 1 + ∑ Xᵢand, whileT ≠ ∅,|S ∪ U| ≥ ∑ Xᵢ(length_stack_le,count_true_le_card);- the vertices found during one epoch lie in one connected component (
reachable_of_mem_comp).
An element of a nonempty finite set: the deterministic choice that replaces the paper's
order σ.
Equations
Instances For
A state of the depth-first search (Krivelevich–Sudakov, Section 2).
- done : Finset V
S: the vertices whose exploration is complete. - stack : List V
U: the stack, last added vertex first. The pairs queried so far.
The pairs whose query was answered positively.
- epochs : ℕ
The number of epochs started so far.
- comp : Finset V
The vertices discovered in the current epoch.
- pushes : ℕ
The number of vertices pushed by a positive answer.
Instances For
T: the unvisited vertices.
Instances For
The unvisited vertices u such that the pair {v, u} has not been queried yet.
Instances For
The pair queried next, if any: {v, u} for the last vertex v of U and a candidate u;
once U = T = ∅, an unqueried pair (completion phase). none if a move without query is due
or every pair has been queried.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A move without query: the last vertex of U moves to S if it has no candidate left; if U
is empty, a vertex of T is pushed, starting a new epoch. Otherwise the state is unchanged.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Record the answer b to the pending query; a positive answer for {v, u} (with v the last
vertex of U) pushes u.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Perform the moves without query until a query is due (2 |V| moves always suffice, as
2 |S| + |U| ≤ 2 |V| increases with each effective move).
Equations
Instances For
The invariant #
The invariant of the search (Krivelevich–Sudakov, Section 2, and the bookkeeping of epochs).
Instances For
Pop: the last vertex of U moves to S.
A negative answer to a query of the search.
A positive answer to a query of the search: u is pushed.
Frame lemmas #
A move either keeps the epoch (and its vertices) or starts a new one with a single vertex.
The answer to the pending query, if any, adds that pair to the queried ones (and to the found ones if positive); without pending query, the answer changes nothing.
Monotonicity #
t extends s: more pairs queried and found, S and S ∪ U larger (so T smaller), more
epochs and pushes.
Instances For
A state where no move is due is either at a query of the search or finished.
After a new epoch starts, settle starts no other one: either the new root has a candidate
(pairs inside T are never queried), or it was the last unvisited vertex.
A query of the search proper (not of the completion phase): a positive answer pushes a new vertex, which joins the current epoch.
Where a query is due, the pending pair exists as long as some pair is unqueried.
The search fed with the answers l, in order, stopped just before its next query.
Equations
- Epidemics.DFS.ofAnswers V l = List.foldl (fun (s : Epidemics.DFS.State V) (b : Bool) => (s.answer b).settle) Epidemics.DFS.State.init.settle l
Instances For
The search as an adaptive strategy on the edge coins: after the answers l, query the pending
pair of ofAnswers V l (or e₀ once every pair has been queried).
Equations
- Epidemics.DFS.nextQuery e₀ l = (Epidemics.DFS.ofAnswers V l).pending.getD e₀
Instances For
Each answer is the answer to a new query: after t ≤ n (n - 1) / 2 answers, exactly t
pairs have been queried, and the found pairs are the positive answers.
Queries #
Every pair is queried at most once: the search is a fresh strategy for all the
n (n - 1) / 2 pairs of distinct vertices.
Each answer is the answer to a new query: after t ≤ n (n - 1) / 2 answers, exactly t
pairs have been queried.
On the coins ω, the search learns ω on the queried pairs: a queried pair has been found
iff its coin is true.
The sets S, U, T #
|U| ≤ 1 + ∑ Xᵢ: every vertex of the stack but the first one of its epoch was pushed by a
positive answer.
While T ≠ ∅, every positive answer has moved a new vertex from T to U: |S ∪ U| is the
number of positive answers plus the number of epochs.
Between two consecutive queries, |S ∪ U| grows by at most 2 (one push by a positive answer,
one new epoch).
Epochs #
The vertices discovered in the current epoch are connected by found pairs.
Within one epoch, while T ≠ ∅, each positive answer adds a vertex to the current epoch.
When a new epoch starts, U has just been emptied: the previously explored set D has all its
pairs with V ∖ D queried; it contains a vertex for each positive answer, and it is contained
in the current S.