Documentation

CslibFrontier.Foundations.Combinatorics.Digraph.Arborescence

Spanning in-arborescences and parent functions #

A digraph T on V is a spanning in-arborescence rooted at r (Digraph.IsInArborescence) if the root has no outgoing arc, every other vertex has exactly one outgoing arc, and every vertex reaches r along arcs. Its arcs point towards the root.

An in-arborescence is determined by its parent function, which sends each vertex v ≠ r to the head of its unique outgoing arc. Conversely, a function p : V → V gives the digraph Digraph.parentDigraph r p with arcs v → p v for v ≠ r. Using the general multidigraph parent-iteration characterization (Cslib.Multidigraph.isInArborescence_iff_exists_iterate), this module proves that parentDigraph r p is a spanning in-arborescence iff iterating p leads from every vertex to r (Digraph.isInArborescence_parentDigraph_iff), and that every spanning in-arborescence arises this way (Digraph.IsInArborescence.exists_parentDigraph_eq).

Main definitions #

Main results #

The directed matrix-tree theorem (CslibFrontier.Foundations.Combinatorics.Digraph.MatrixTree) counts these arborescences, and the Chu–Liu/Edmonds algorithm (CslibFrontier.Algorithms.Lean.Arborescence.ChuLiuEdmonds) optimizes over them.

structure Digraph.IsInArborescence {V : Type u_1} (T : Digraph V) (r : V) :

T is a spanning in-arborescence rooted at r, an oriented spanning tree with every arc directed towards r: the root has no outgoing arc, every other vertex has exactly one outgoing arc, and every vertex reaches r along arcs.

  • not_adj_root (w : V) : ¬T.Adj r w

    The root has no outgoing arc.

  • existsUnique_adj (v : V) : v ≠ r → ∃! w : V, T.Adj v w

    Every vertex other than the root has exactly one outgoing arc.

  • reachable (v : V) : Relation.ReflTransGen T.Adj v r

    Every vertex reaches the root along arcs.

def Digraph.parentDigraph {V : Type u_1} (r : V) (p : V → V) :

The digraph of a parent function p: the arcs v → p v for v ≠ r.

@[instance_reducible]
@[simp]
theorem Digraph.parentDigraph_adj {V : Type u_1} {r : V} {p : V → V} {v w : V} :
(parentDigraph r p).Adj v w ↔ v ≠ r ∧ p v = w
theorem Digraph.reflTransGen_parentDigraph_of_iterate_eq {V : Type u_1} {r : V} {p : V → V} {n : ℕ} {v : V} (h : p^[n] v = r) :

If iterating p leads from v to r, then v reaches r in parentDigraph r p.

theorem Digraph.exists_iterate_eq_of_reflTransGen_parentDigraph {V : Type u_1} {r : V} {p : V → V} {v : V} (h : Relation.ReflTransGen (parentDigraph r p).Adj v r) :
∃ (n : ℕ), p^[n] v = r

If v reaches r in parentDigraph r p, then iterating p leads from v to r.

theorem Digraph.isInArborescence_parentDigraph_iff {V : Type u_1} {r : V} {p : V → V} :
(parentDigraph r p).IsInArborescence r ↔ ∀ (v : V), ∃ (n : ℕ), p^[n] v = r

The digraph of a parent function is a spanning in-arborescence rooted at r iff iterating the parent function leads from every vertex to r.

theorem Digraph.IsInArborescence.exists_parentDigraph_eq {V : Type u_1} {T : Digraph V} {r : V} (hT : T.IsInArborescence r) :
∃ (p : V → V), p r = r ∧ parentDigraph r p = T

Every spanning in-arborescence rooted at r is the digraph of a parent function fixing r.