Whole-graph Bellman–Ford and shortest-path hop diameter
DefinitionPaceSSSP517_Certified_Supplement_GraphOperatorsLet be the published finite positive-real weighted undirected graph, with source . For a real profile , define the synchronous whole-graph Bellman–Ford operator by
Both orientations of every undirected edge contribute. The minimum is over a finite nonempty set. For each vertex, take the least number of edges among the shortest source-to-vertex walks, and let be their maximum. Connectivity and positive weights ensure shortest walks exist; no attainment hypothesis is added to the theorem.
These are the full-graph operator and source hop diameter used in Theorem 3.7, independent of the stored subgraph. The general graph, walks, weights and distances are imported from the published base definition.
Formalization Note Vertices are numbered by Fin n, a walk lists its endpoints and has vertices when it has edges, and Nat.sInf selects the least hop count. On disconnected inputs with no shortest walk, the unused default hop count is zero. All theorem uses have connected graphs.
import Definitions.Def_PaceSSSP517_Certified_Graph
set_option autoImplicit false
open Classical
namespace PaceSSSP517.Certified.Supplement
/-- Whole-graph synchronous Bellman–Ford on finite real profiles, Theorem 3.7(ii),
p.7. A non-neighbour contributes the already included value d(v). The canonical
edge lookup permits both orientations of every undirected edge. -/
noncomputable def BF {n : ℕ} (G : WeightedGraph n) (d : Fin n → ℝ)
(v : Fin n) : ℝ :=
let candidates := Finset.univ.image (fun u =>
if edge u v ∈ G.edges then d u + G.weight (edge u v) else d v)
(insert (d v) candidates).min' (Finset.insert_nonempty _ _)
/-- Least number of edges on a shortest source-to-v walk, §3.1 p.5.
The predicate has a witness on the connected positive-weight graphs used below.
Nat.sInf gives 0 on the empty set, an unused disconnected-input convention. -/
noncomputable def shortestHops {n : ℕ} (G : WeightedGraph n) (s₀ v : Fin n) : ℕ :=
sInf {h : ℕ | ∃ p : List (Fin n),
IsWalk G.edges s₀ v p ∧ pathCost G p = distance G G.edges s₀ v ∧
p.length = h + 1}
/-- Maximum of the minimum hop counts among shortest paths from s₀, §3.1 p.5.
The inserted zero only specifies the unused empty-vertex case. -/
noncomputable def hopDiameter {n : ℕ} (G : WeightedGraph n) (s₀ : Fin n) : ℕ :=
(Finset.univ : Finset (Fin n)).sup (shortestHops G s₀)
end PaceSSSP517.Certified.Supplement