Finding common MSTs

Given two weighted, undirected graphs on 𝑛 nodes 𝐺1 and 𝐺2, is it possible to efficiently find a tree on these 𝑛 nodes that is an MST of both 𝐺1 and 𝐺2?

It turns out that we can simply construct a new graph 𝐺 where the weight of each edge is the sum of that edge’s weights in 𝐺1 and 𝐺2, and find the MST on this graph. If a common MST exists, we can guarantee that this algorithm will always find it.

Proof. Let π‘Š1, π‘Š2, and π‘Š denote the total weight of MSTs for 𝐺1, 𝐺2, and 𝐺 respectively.

  • Note that π‘Š1+π‘Š2β‰€π‘Š.
  • Also note that the weight of any spanning tree in 𝐺1 is at least π‘Š1, and similarly for 𝐺2. Therefore, if we find a spanning tree 𝑇 with exactly π‘Š=π‘Š1+π‘Š2, it must follow that 𝑇 has exactly weight π‘Š1 in 𝐺1 and exactly weight π‘Š2 in 𝐺2, since these are the minimum possible.

Here’s a problem that uses this idea: 1054G - New Road Network