简体   繁体   中英

Algorithm finding an MST using DFS

I have the following algorithm: For a given (finite undirected simple) graph G=(V,E) with positive weight function on the edges:

  1. Run DFS (depth-first-search) till you find an edge going backwards or DFS stopped. If stopped, return G.
  2. On the circle that is constructed by the backwards going edge find the heaviest edge and remove it from G.
  3. Return to 1.

Now I need to understand what this algorithm is doing. I have already proven that the algorithm gives me a spanning tree of G and I believe it's a minimum spanning tree but I fail to prove that. Please help me to prove that.

看起来您正在执行反向删除算法的变体,但您仍需要证明您的算法与删除不断开图形的所有最高加权边缘等效。

Prove that, when e is the heaviest edge in a cycle of G, the cost of the MST of G - e is no greater than the cost of the MST of G. (Let T be an MST for G and use T and the assumption about e to construct a spanning tree T' of G - e with cost(T') ≤ cost(T).) Conclude by induction on |E| that the algorithm produces an MST.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM