Search⌘ K

Distinct Edge Weights

Explore the concept of distinct edge weights and how they ensure the uniqueness of minimum spanning trees in connected weighted graphs. Understand the proof using greedy exchange and learn a tie-breaking method for edges with equal weights. This lesson helps you implement reliable algorithms for finding minimum spanning trees in Python.

Suppose we are given a connected, undirected, weighted graph. This is a graph G=(V,E)G = (V, E) together with a function w:ERw: E \rightarrow \mathbb{R} that assigns a real weight w(e)w(e) to each edge ee, which may be positive, negative, or zero. This chapter describes several algorithms to find the minimum spanning tree of G\bold{G}, that is, the spanning tree T that minimizes the function

w(T):=e ε Tw(e).w(T):=\underset{e \space\varepsilon\space T}{\sum}w(e).

Distinct edge weights

An annoying subtlety in the problem statement is that weighted graphs can have more than one spanning tree with the same minimum weight; in particular, if every edge in GG has weight 11, then every spanning tree of GG is a minimum spanning tree, with weight V1V − 1. This ambiguity complicates the development of our algorithms; everything would be much simpler if we could simply assume that minimum spanning trees are unique.

 A weighted graph and its minimum spanning tree
A weighted graph and its minimum spanning tree

Proof of the uniqueness of minimum spanning tree

Fortunately, there is an easy condition that implies the uniqueness we want.

Lemma: If all edge weights in a connected graph GG are distinct, then GG has a unique minimum spanning tree.

Proof: Let GG be an arbitrary connected graph with two minimum spanning trees TT and TT^′; we need to prove that some pair of edges in GG have the same weight. The proof is essentially a greedy exchange argument. Each of our spanning trees must contain an edge that the other tree omits. Let ee be a minimum-weight edge in T\TT \backslash T^′, and let ee^′ ...