Steiner tree in graphs: the metric completion and the Kou–Markowsky–Berman heuristic #
This module carries the MST 2-approximation of CslibFrontier.Algorithms.Lean.SteinerTree.Metric
over to Steiner tree in an edge-weighted graph, whose costs need not satisfy the triangle
inequality ([WS11], Exercise 2.5(b)). The algorithm computes a minimum spanning
tree on the terminals under shortest-path distances (the metric completion), and then replaces
each tree edge by the edges of a shortest walk. This is steps 1–3 of the heuristic of Kou, Markowsky
and Berman [KMB81].
Model #
- The graph is a Mathlib
SimpleGraph Vwith edge weightsw : Sym2 V → ℕ. The cost of a walk iswalkWeight w p, the sum of the weights of its edges with multiplicity. - A solution is a finite edge set
F : Finset (Sym2 V)of edges ofGwhose spanning subgraphSimpleGraph.fromEdgeSet Fconnects every two terminals (IsSteinerSubgraph). Its cost isF.sum w. Weights are nonnegative, so a cheapest suchFmay be taken to be a tree. graphSteinerOpt w G Ris the least cost of a Steiner subgraph. It is0when there is no Steiner subgraph. With a shortest-walk oracle there always is one (isSteinerSubgraph_kmbEdges).- Shortest walks are given by an oracle
P : ∀ u v, G.Walk u vwith no walk cheaper thanP u v(IsShortestWalkOracle). Any shortest-path algorithm can supply it. Every preconnected graph has an oracle (exists_isShortestWalkOracle). Conversely, the walksP u vthemselves show thatGis preconnected. The oracle's costs are the metric completionmetricCompletion w G(IsShortestWalkOracle.walkWeight_eq). kmbEdges w P RrunssteinerMSTon the costswalkWeight w (P u v)and returns the set of edges of the walksP u valong the tree edges.- Shortest-walk oracle costs have a zero diagonal
(
walkWeight w (P x x) ≤ walkWeight w Walk.nil = 0), so repeated terminals do not change the weight of the minimum spanning tree. The bounds use the zero-diagonal metric variantlength_mul_edgeCost_steinerMST_le_of_diagand hold for arbitrary terminal lists without assumingR.Nodup.
Source mapping #
- [WS11], Exercise 2.5(b): for a connected graph, running the MST algorithm in the
metric completion and adding the edges of a shortest path for each tree edge is a
2-approximation. The Lean statements are
isSteinerSubgraph_kmbEdgesandsum_kmbEdges_le_two_mul_graphSteinerOpt. The exercise's output is a tree. Ours is the connected edge set before cycles are removed, and any spanning tree of it is no more expensive. That reduction is not formalized here. - [KMB81], steps 1–3 (shortest-path distance graph on the terminals, its minimum
spanning tree, replacement by shortest paths) are
kmbEdges. Steps 4–5 (a minimum spanning tree of the result, then pruning non-terminal leaves) only lower the cost and are not formalized. The sharper factor2 (1 - 1/|R|)islength_mul_sum_kmbEdges_le. The paper's2 (1 - 1/ℓ), withℓthe number of leaves of an optimal tree, is not formalized. The paper'sO(|S| |V|²)running time is not formalized either. (The locators for [KMB81] come from its abstract, not from its body.)
Main definitions #
walkWeight,metricCompletion: walk costs and shortest-path distances.IsShortestWalkOracle: a choice of shortest walks.IsSteinerSubgraph,graphSteinerOpt: the graph Steiner tree problem.expandEdges,kmbEdges: replacing pairs by shortest walks, and the heuristic.
Main results #
exists_isShortestWalkOracle,IsShortestWalkOracle.walkWeight_eq: shortest-walk oracles exist on preconnected graphs and compute the metric completion.IsShortestWalkOracle.symm,IsShortestWalkOracle.triangle: the metric completion is symmetric and satisfies the triangle inequality.isSteinerSubgraph_kmbEdges: the heuristic returns a Steiner subgraph.length_mul_sum_kmbEdges_le:|R| · cost(kmbEdges) ≤ 2 (|R| - 1) · cost(F)for every Steiner subgraphF.sum_kmbEdges_le_two_mul_graphSteinerOpt:cost(kmbEdges) ≤ 2 · OPT.
References #
Walk costs and the metric completion #
The cost of a walk: the sum of the weights of its edges, with multiplicity.
The metric completion of G: the least cost of a walk from u to v. It is 0 when
there is no such walk.
P chooses a shortest walk between every two vertices.
A preconnected graph has a shortest-walk oracle.
A shortest-walk oracle computes the metric completion.
The problem #
F is a set of edges of G whose spanning subgraph connects every two terminals.
The optimum graph Steiner cost: the least weight of a Steiner subgraph (0 if there is
none).
Expanding pairs into walks #
The edges of the walks P u v for the pairs (u, v) of T.
Pairs related by T are connected through the expanded edges.
The expanded edges cost at most the walks: shared edges are paid for once.
From edge sets to pair lists #
The Kou–Markowsky–Berman heuristic #
The Kou–Markowsky–Berman heuristic, steps 1–3: the MST heuristic on the terminals under
the shortest-walk costs of P, with each tree edge replaced by the edges of its shortest walk.
For a shortest-walk oracle, the tree in kmbEdges is the MST heuristic in the metric
completion.
The heuristic returns a Steiner subgraph.
The Kou–Markowsky–Berman heuristic, sharp form: for a shortest-walk oracle,
|R| · cost(kmbEdges) ≤ 2 (|R| - 1) · cost(F) for every Steiner subgraph F. This is the factor
2 (1 - 1/|R|), a restricted form of [KMB81]'s 2 (1 - 1/ℓ) with ℓ the number
of leaves of an optimal tree.
The heuristic costs at most twice any Steiner subgraph.
If G has walks between all pairs of vertices, the optimum is attained.
The metric-completion MST 2-approximation for Steiner tree in graphs
([WS11], Exercise 2.5(b)): cost(kmbEdges) ≤ 2 · OPT.