Reprint: http://blog.csdn.net/anye3000/article/details/12091125
Exercises 23.1-Introduction to Algorithms. English 3rd Edition
If there is any shortage or doubt, please correct me.
Exercises 23.1-1Let (U, v) is a minimum-weight edge in a connected graph G. Show that (U, v) belongs to some minimum spanning tree of G. According to the theorem theorem 23.1
It is known that using Cut (S, v-s) to separate U, v two points, because (U, v) is the lightest edge, so (U, v) belong to the minimum spanning tree.
Exercises 23.1-2Professor Sabatier Conjectures the following converse of theorem 23.1. Let G = (V, E) is a connected, undirected graph with a real-valued weight function W defined on E. Let a being a subset of E that's included in some minimum spanning tree for G, let (S, v-s) being any cut of G that respects A, and let (U, v) is a safe edge for a crossing (S, V-s). Then, (U, v) are a light edge for the cut. Show that the professor's conjecture is incorrect by giving a counterexample. From the analysis, it can be learned that any undirected connected graph, through the cut of the lightest edge must be safe, but not the lightest edge is also likely to be safe, as follows.
For this cut, although (A, C) is safe, it is not the lightest.
Exercises 23.1-3Show that if an edge (U, v) was contained in some minimum spanning tree and then it was a light edge crossing some cut of the G Raph. (U, v) is the smallest spanning tree A, assuming that the cut does not affect the other side of a In addition (U, v), only a (U, v) through the cut, so (U, v) on the cut is the lightest edge, otherwise (U, v) does not belong to a.
Exercises 23.1-4Give A simple example of a connected graph such and the set of edges {(U, v): there exists a cut (S, v-s) such that ( U, v) is a light edge crossing (S, V-s)} does not form a minimum spanning tree. With the same weight of the triangle three edges, each edge is the lightest in a cut, and there is no ring in the result, so it is not the smallest spanning tree.
Exercises 23.1-5Let
eBe a maximum-weight edge on some cycle of connected graph G = (V, E). Prove that there is a minimum spanning tree of G ' = (V, E-{
e}) That's also a minimum spanning tree of G. That is, there are a minimum spanning tree of G that does not include
e. Because E is the most weighted edge in some circles, the vertices in the back circle of the e are removed and can still be connected. Assuming that the minimum spanning tree A does not contain E, the edge set is T, the same assumption contains the case of E, the edge set is T ', both t ' is T ' is the X of the edge, and the E. (minimum spanning tree edge number is constant V-1) W (t ') = W (t)-W (x) + W >= W (T) so the smallest spanning tree A does not contain E.
Exercises 23.1-6Show that a graph have a unique minimum spanning tree if, for every cut of the graph, there are a unique light edge crossing The cut. Show that the converse are not true by giving a counterexample. Suppose there are two minimum spanning trees T and T '. Any side e belongs to T, if E is removed from T, then t becomes disconnected, forming cut (s, v-s), according to the practice 23.1-3, E is the lightest edge through cut (s, v-s). Assuming that the Edge x belongs to T ' and passes through cut (S, v-s), X is also the lightest edge. Because the lightest edge is unique across the cut (S, v-s). Both E and X are the same edge. So e also belongs to T ', because we choose E to be arbitrary, all sides in T, likewise in t '. The smallest spanning tree is unique. The exchange of conditions and conclusions is not tenable, as follows.
Exercises 23.1-7argue that if all edge weights of a graph is positive, then any subset of edges the connects all vertices and have minimu M total weight must is a tree. Give An example to show that the same conclusion does is follow if we allow some weights to be nonpositive. Assuming that there is a ring in the subset T of the edge, there are multiple pathways between the two points and one of the paths is removed, and subset a ' remains connected to all points. Because the weight of the edge is positive, both w (a ') < W (a), the conclusion is inconsistent with the condition, so T is the tree. If the weight of the edge is allowed to be negative, then the subset T is not necessarily a tree, and the total weight of the three edges in the figure is minimal, as follows.
Exercises 23.1-8Let T is a minimum spanning tree of a graph G, and let L be the sorted list of the edge weights of T. Show that for any other minimum spanning tree T ' of G, the list L is also the sorted list of the edge weights of t '. Assuming that the minimum spanning tree has n edges, there are two minimum spanning trees T and T ', with W (e) Representing the weights of the edges. T weight Increment arrangement W (A1) <= W (A2) <= ... w (an) T ' weight increment permutation w (B1) <= W (B2) <= ... W (BN) assumes I is a two list, first occurrence edge different position, both Ai≠bi, First assume W (AI) >= w (BI). In case 1, if T contains side bi, because AI and bi are the same before the position of the list I, if the inclusion of BI is necessarily at the I position, both J > I make w (AJ) = W (BI). Get W (BI) = w (AJ) >= W (AI) >= w (BI), both w (bi) = w (AJ) = W (AI), so the weights at the edge of the I position are the same. In case 2, if T does not contain edge bi, then the bi is added to T and a circle is formed somewhere. Since t is the smallest spanning tree, the weights of any one edge in the circle are less than or equal to W (BI), and in this circle there must be AJ not in T ', which yields w (AJ) <= W (BI) and J > I. So w (BI) <= w (AI) <= W (A j) <= W (BI), w (BI) = w (AJ) = W (AI), the weights at the edge of the I position are still the same.
Exercises 23.1-9Let T is a minimum spanning tree of a graph G = (V, E), and let V ' is a subset of V. Let T ' is the subgraph of T induced by V ', and let G ' is the subgraph of G induced by V '. Show that if T ' are connected, then T ' is a minimum spanning tree of G '. Using Cut (V ', v-v ') to divide the graph G, the cut must not affect t ', and T ' is a subset of T, so t ' is safe for G '. If T ' is connected, then T ' must be the smallest spanning tree of G '.
Exercises 23.1-10Given a graph G and a minimum spanning tree T, suppose that we decrease the weight of one of the edges in T. Show that T was still a minimum spanning tree for G. More formally, let T is a minimum spanning tree for G with edge weights given by weight function W. Choose One edge (x, y) ∈t and a positive number k, and define the weight function W ' by
Show that's a minimum spanning tree for G with edge weights given by W '. Since W (t)-k = W ' (t) and K is positive, suppose X is any other spanning tree, there is w (t) <= W (X). If x contains (x, y), then W ' (t) <= W ' (x), if X does not contain (x, y), then W ' (t) <= W ' (x)-K, both cases W ' (t) are the smallest. In addition, the other properties of T are not changed after the weight reduction, and all vertices are still connected and have no loops. So using w ' to calculate weights, T is still the smallest spanning tree.
Exercises 23.1-11 *Given a graph G and a minimum spanning tree T, suppose that we decrease the weight of one of the edges isn't in T. Give an algorithm for finding the minimum spanning tree in the modified graph. Assuming that (U, v) is not in the minimum spanning tree T, decrease (U, v) weights to form a new minimum spanning tree t '. The possible situation is that T ' contains (U, v) or t ' = t remains unchanged. The algorithm simply looks for the heaviest edge x in the U-v path in T and if the edge weight is greater than (U, v), then t ' = T-x + (U, v). If the (U, v) weight is greater than X, then t ' = t. The path can be evaluated by the DFS algorithm, ending with a V from U. Because T is the smallest spanning tree, the path is unique, time O (v+e).
Introduction to Algorithms exercises 23.1