How to find maximum spanning tree?

user467871 picture user467871 · Feb 14, 2011 · Viewed 99.4k times · Source

Does the opposite of Kruskal's algorithm for minimum spanning tree work for it? I mean, choosing the max weight (edge) every step?

Any other idea to find maximum spanning tree?

Answer

systemkern picture systemkern · Feb 14, 2011

Yes, it does.

One method for computing the maximum weight spanning tree of a network G – due to Kruskal – can be summarized as follows.

  1. Sort the edges of G into decreasing order by weight. Let T be the set of edges comprising the maximum weight spanning tree. Set T = ∅.
  2. Add the first edge to T.
  3. Add the next edge to T if and only if it does not form a cycle in T. If there are no remaining edges exit and report G to be disconnected.
  4. If T has n−1 edges (where n is the number of vertices in G) stop and output T . Otherwise go to step 3.

Source: https://web.archive.org/web/20141114045919/http://www.stats.ox.ac.uk/~konis/Rcourse/exercise1.pdf.