Slim Span
来源:UVA
标签:图论
参考资料:《算法竞赛入门经典(第2版)》P358
相似题目:
题目
Given an undirected weighted graph G, you should find one of spanning trees specified as follows. The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, . . . , vn} and E is a set of undirected edges {e1, e2, . . . , em}. Each edge e ∈ E has its weight w(e). A spanning tree T is a tree (a connected subgraph without cycles) which connects all the n vertices with n−1 edges. The slimness of a spanning tree T is defined as the difference between the largest weight and the smallest weight among the n − 1 edges of T.
For example, a graph G in Figure 5(a) has four vertices {v1, v2, v3, v4}