wiener_index
def
The Wiener index of a finite simple graph G is the sum of the shortest-path distances between all unordered pairs of vertices in G.
Statement
noncomputable def wiener_index {V : Type*} [Fintype V] (G : SimpleGraph V) : ℕ
- Defined in
- arXiv:2611.01808 Section 1, p. 3; Wiener (1947)
- Verified
- 04 Nov 2026
- Axioms
- none listed
- Used by 3
- deltaFor a finite simple graph G on vertex type V, delta G is the integer (max_induced_linear_forest G : ℤ) * (Fintype.card V : ℤ) *…
- wiener_index_add_edges_twin_independent_setLet G and H be simple graphs on a finite vertex type V, where G is connected. Suppose Z and X are subsets of V such that 2 ≤ Nat.card X, Z…
- wiener_index_botThe Wiener index of the empty graph on any finite vertex type is zero.
Read back from the Lean
Given a type V with a Fintype V instance and a simple graph G on V, wiener_index G is defined as the natural number obtained by summing the graph distance G.dist u v over all unordered pairs e : Sym2 V (lifted to Sym2 V using the symmetry of G.dist). Since G.dist v v = 0, this equals the sum of the distances between all distinct pairs of vertices in V (with distance 0 between unreachable pairs).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- The Wiener index of a finite simple graph, defined as the sum of distances over all unordered pairs of vertices. -/ noncomputable def wiener_index {V : Type*} [Fintype V] (G : SimpleGraph V) : ℕ := ∑ e : Sym2 V, Sym2.lift ⟨fun u v => G.dist u v, fun _ _ => G.dist_comm⟩ e