Documentation

CslibFrontier.Foundations.Combinatorics.Multidigraph.BEST

The BEST theorem #

An Eulerian circuit of a finite multidigraph src tgt : E → V is a closed walk that uses every arc exactly once. Fixing the arc e₀ with which it starts, it is a duplicate-free list of all the arcs, starting with e₀, in which each arc ends where the next one starts and the last one ends where e₀ starts (Cslib.Multidigraph.IsEulerianCircuit). Every Eulerian circuit is a rotation of exactly one that starts with e₀, so these are the Eulerian circuits counted up to rotation.

The BEST theorem (named after de Bruijn, van Aardenne-Ehrenfest, Smith and Tutte; the result is due to van Aardenne-Ehrenfest and de Bruijn [vAdB51], while Smith and Tutte [ST41] counted a special class) counts them. If every vertex has as many outgoing as incoming arcs and at least one outgoing arc, the number of Eulerian circuits starting with e₀ is τ * ∏ v, (d⁺ v - 1)!, where τ is the number of spanning in-arborescences rooted at the source of e₀ and d⁺ v is the number of arcs out of v (Cslib.Multidigraph.natCard_isEulerianCircuit; [Sta13], Theorem 10.2). With the directed matrix-tree theorem, τ is the determinant of the reduced Laplacian (Cslib.Multidigraph.natCard_isEulerianCircuit_eq_det_mul; [Sta13], Corollary 10.5). The source assumes a connected balanced digraph. Connected and balanced with at least one arc implies that every vertex has an outgoing arc, so the hypotheses here are weaker: connectivity is not assumed, and a multidigraph that is not connected and in which every vertex has an outgoing arc has neither Eulerian circuits nor spanning arborescences. Conversely, a multidigraph with an Eulerian circuit is balanced (Cslib.Multidigraph.IsEulerianCircuit.card_filter_src_eq).

The proof sorts the arcs out of each vertex v in the order in which a circuit uses them. For v ≠ r = src e₀ the last of these arcs is the last exit from v, and the last exits form a spanning in-arborescence rooted at r: the last arc of the circuit leaving a set of vertices that never reach r would have to end inside that set. The orders determine the circuit, since the next arc is always the first unused arc out of the current vertex. Conversely, any orders that start with e₀ at r and end with the arc of a fixed arborescence everywhere else are realized: the walk that always takes the next arc in the order can stop only at r once all arcs out of r are used, by the balance, and then every arc is used, because the set of vertices with unused arcs is closed under following the arborescence and avoids r. There are (d⁺ v - 1)! such orders at each vertex.

Main definitions #

Main results #

References #

structure Cslib.Multidigraph.IsEulerianCircuit {V : Type u_1} {E : Type u_2} (src tgt : E → V) (e₀ : E) (l : List E) :

l is an Eulerian circuit of the multidigraph src tgt : E → V starting with the arc e₀: a list of all the arcs, each exactly once, starting with e₀, in which each arc ends where the next one starts and the last arc ends where e₀ starts.

  • nodup : l.Nodup

    No arc is used twice.

  • mem (e : E) : e ∈ l

    Every arc is used.

  • head : l.head? = some e₀

    The circuit starts with e₀.

  • isChain : List.IsChain (fun (a b : E) => tgt a = src b) l

    Each arc ends where the next one starts.

  • getLast (e : E) : e ∈ l.getLast? → tgt e = src e₀

    The last arc ends where e₀ starts.

Lists #

Counting orders #

Walks #

theorem Cslib.Multidigraph.IsEulerianCircuit.card_filter_src_eq {V : Type u_1} {E : Type u_2} {src tgt : E → V} [DecidableEq V] [Fintype E] {e₀ : E} {l : List E} (hl : IsEulerianCircuit src tgt e₀ l) (v : V) :
{e : E | src e = v}.card = {e : E | tgt e = v}.card

A multidigraph with an Eulerian circuit is balanced: every vertex has as many outgoing as incoming arcs. This is the necessity half of [Sta13], Theorem 10.1.

Last exits #

The circuit is determined by the orders of the arcs out of each vertex #

Every admissible family of orders is realized #

Counting #

theorem Cslib.Multidigraph.natCard_isEulerianCircuit {V : Type u_1} {E : Type u_2} (src tgt : E → V) [DecidableEq V] [Fintype E] [Fintype V] (hbal : ∀ (v : V), {e : E | src e = v}.card = {e : E | tgt e = v}.card) (hpos : ∀ (v : V), ∃ (e : E), src e = v) (e₀ : E) :
Nat.card { l : List E // IsEulerianCircuit src tgt e₀ l } = Nat.card { f : { v : V // v ≠ src e₀ } → E // IsInArborescence src tgt (src e₀) f } * ∏ v : V, ({e : E | src e = v}.card - 1).factorial

The BEST theorem [vAdB51] ([Sta13], Theorem 10.2). In a finite multidigraph in which every vertex has as many outgoing as incoming arcs, and at least one outgoing arc, the number of Eulerian circuits starting with the arc e₀ is the number of spanning in-arborescences rooted at the source of e₀, times ∏ v, (d⁺ v - 1)!, where d⁺ v is the number of arcs out of v. The source assumes a connected balanced digraph, which implies these hypotheses; connectivity is not needed.

theorem Cslib.Multidigraph.natCard_isEulerianCircuit_eq_det_mul {V : Type u_1} {E : Type u_2} (src tgt : E → V) [DecidableEq V] [Fintype E] [Fintype V] (R : Type u_3) [CommRing R] (hbal : ∀ (v : V), {e : E | src e = v}.card = {e : E | tgt e = v}.card) (hpos : ∀ (v : V), ∃ (e : E), src e = v) (e₀ : E) :
↑(Nat.card { l : List E // IsEulerianCircuit src tgt e₀ l }) = ((arcMatrix src tgt R).laplacian.submatrix Subtype.val Subtype.val).det * ∏ v : V, ↑({e : E | src e = v}.card - 1).factorial

The BEST theorem, determinant form ([Sta13], Corollary 10.5). In a finite multidigraph in which every vertex has as many outgoing as incoming arcs, and at least one outgoing arc, the number of Eulerian circuits starting with the arc e₀ is the determinant of the reduced Laplacian of the arc-count matrix, with the row and column of the source of e₀ deleted, times ∏ v, (d⁺ v - 1)!.

Rotation of Eulerian circuits and root independence #

def Cslib.Multidigraph.IsEulerianCircuit.equivRotate {V : Type u_1} {E : Type u_2} {src tgt : E → V} [DecidableEq E] (e₀ e₁ : E) :
{ l : List E // IsEulerianCircuit src tgt e₀ l } ≃ { l : List E // IsEulerianCircuit src tgt e₁ l }

Cyclic rotation gives a bijection between Eulerian circuits starting with e₀ and Eulerian circuits starting with e₁ ([Sta13], proof of Corollary 10.3, p. 193).

@[simp]
theorem Cslib.Multidigraph.IsEulerianCircuit.coe_equivRotate {V : Type u_1} {E : Type u_2} {src tgt : E → V} [DecidableEq E] (e₀ e₁ : E) (l : { l : List E // IsEulerianCircuit src tgt e₀ l }) :
↑((equivRotate e₀ e₁) l) = List.drop (List.idxOf e₁ ↑l) ↑l ++ List.take (List.idxOf e₁ ↑l) ↑l
@[simp]
theorem Cslib.Multidigraph.IsEulerianCircuit.coe_equivRotate_symm {V : Type u_1} {E : Type u_2} {src tgt : E → V} [DecidableEq E] (e₀ e₁ : E) (l : { l : List E // IsEulerianCircuit src tgt e₁ l }) :
↑((equivRotate e₀ e₁).symm l) = List.drop (List.idxOf e₀ ↑l) ↑l ++ List.take (List.idxOf e₀ ↑l) ↑l
theorem Cslib.Multidigraph.natCard_isEulerianCircuit_eq {V : Type u_1} {E : Type u_2} (src tgt : E → V) (e₀ e₁ : E) :
Nat.card { l : List E // IsEulerianCircuit src tgt e₀ l } = Nat.card { l : List E // IsEulerianCircuit src tgt e₁ l }

The number of Eulerian circuits starting with a fixed arc e₀ is independent of e₀ ([Sta13], proof of Corollary 10.3, p. 193).

theorem Cslib.Multidigraph.natCard_isInArborescence_eq_of_isEulerianCircuit {V : Type u_1} {E : Type u_2} (src tgt : E → V) [DecidableEq V] [Fintype E] (hbal : ∀ (v : V), {e : E | src e = v}.card = {e : E | tgt e = v}.card) (hpos : ∀ (v : V), ∃ (e : E), src e = v) (e₀ e₁ : E) :
Nat.card { f : { v : V // v ≠ src e₀ } → E // IsInArborescence src tgt (src e₀) f } = Nat.card { f : { v : V // v ≠ src e₁ } → E // IsInArborescence src tgt (src e₁) f }

Root independence of the arborescence count ([Sta13], Corollary 10.3, p. 193). On a finite balanced multidigraph in which every vertex has an outgoing arc, any two arcs e₀ and e₁ yield equal spanning in-arborescence counts at their sources src e₀ and src e₁; more generally, Multidigraph.natCard_isInArborescence_eq establishes root independence across all vertices of any finite balanced multidigraph.