For a finite connected graph, a spanning tree contains every graph vertex and is connected and acyclic. A minimum spanning tree minimizes over all such trees. A shortest-path tree rooted at is a spanning tree whose unique -to- graph path has length for every graph vertex . Here the weighted path length is the sum of its edge weights. The two optimizations generally differ, as (b) shows. Connectedness is needed for either spanning-tree object to exist.
For the grid, Kruskal's algorithm examines edges in nondecreasing order of weight and accepts an edge exactly when it joins two different components of the current forest. The weights are encountered in the orderThe horizontal and vertical acceptance rules are detailed in the two numbered subanswers. Together they produceThere are horizontal and vertical edges, totaling . Every accepted edge attaches a previously isolated graph vertex to the component already built, so the result is connected and acyclic. The correctness theorem for Kruskal's algorithm, which follows from the minimum spanning tree cut property, proves minimality. Its total cost isFor the tree has one graph vertex, no edges and cost zero. The source's numbered items specify the two edge types; the following subanswers record their contributions to the algorithm.
Kruskal spanning tree of the weighted grid, with accepted horizontal and vertical edges highlighted
. Details. At weight the edges considered are precisely the horizontal edges in row . For all graph vertices in that row are isolated, so all edges are accepted. For , the first graph vertices in that row already belong to the one component built by earlier stages, because vertical columns have already been processed. The other graph vertices are isolated. Thus the edges with would create a graph cycle, and all the edges with are accepted, successively attaching the remaining graph vertices. The rule isThe selected edges of equal weight have no cycles after the existing component is contracted, so tie ordering does not affect this conclusion. Their combined contribution to the minimum spanning tree cost is
At weight , column is considered just after horizontal row . At this point its first graph vertices already lie in the component built so far, while graph vertices above them in that column are isolated. Consequently vertical edges with create a graph cycle, while those with attach the isolated graph vertices in a chain:Together with the horizontal rule this gives an induction on the alternating row and column stages and justifies the component description used in both numbered answers. The vertical contribution to the minimum spanning tree cost is
Articles by others on the same topic
There are currently no matching articles.
