Question

In: Computer Science

Suppose T is a minimal spanning tree found by Prim’s algorithm in a connected graph G....

Suppose T is a minimal spanning tree found by Prim’s algorithm in a connected graph
G.

(i) Show that either T contains the n-1 smallest edges, or the n-1 smallest edges form a subgraph which contains a cycle.

(ii) Show that if an edge (a, b) is not in T and if P is the unique path in T from a to
b, then for each edge e in P the weight of e is less than the weight of the edge (a, b).

Solutions

Expert Solution

i)The MST i.e T is built gradually by adding edges one at a time. At first the spanning tree consists only of a single vertex, which is choosen randomly. Then the edge having minimum weight outgoing from this vertex is selected and added to the spanning tree. After that the spanning tree already consists of two vertices. Now select and add the edge with the minimum weight that has one end in an already selected vertex (i.e. a vertex that is already part of the spanning tree), and the other end in an unselected vertex. And so on, i.e. every time we select and add the edge with minimal weight that connects one selected vertex with one unselected vertex. The process is repeated until the spanning tree contains all vertices (or equivalently until we have n−1edges).

In the end the constructed spanning tree will be minimal. If the graph was originally not connected, then there doesn't exist a spanning tree, so the number of selected edges will be less than n−1.

EXAMPLE- WE CAN SEE THAT THERE ARE TOTAL OF 9 VERTICES IN GRAPH AND (9-1) I.E 8 EDGES IN MINIMUM SPANNING TREE

.

ii)Prim’s algorithm is a Greedy algorithm. For any cycle in the graph, if the weight of an edge E of cycle is larger than the individual weights of all other edges of cycle, then this edge cannot belong to a Minimum Spanning tree.

From the above example we can say that if if an edge (A, B) is not in MST (as and if P is the unique path in MST from A to B, then for each edge e in MST the weight of e is less than the weight of the edge (A, B).

EXAMPLE-


Related Solutions

Let G be a connected graph which contains two spanning trees T1 and T2 that do...
Let G be a connected graph which contains two spanning trees T1 and T2 that do not share any edges (note that G may contain edges that are in neither trees). Prove that G does not have a bridge. I have a hint for the answer: Show that each edge is in a cycle (2 cases). But I can't figure out the 2 cases. Some help please!
Prove that Kruskal’s algorithm finds a minimum weight spanning tree.
Prove that Kruskal’s algorithm finds a minimum weight spanning tree.
Java programming Trace the algorithm for minimum spanning tree (eager, lazy Prim algorithm)
Java programming Trace the algorithm for minimum spanning tree (eager, lazy Prim algorithm)
Write an algorithm to determine if the directed graph is strongly connected or not
Write an algorithm to determine if the directed graph is strongly connected or not
Suppose G is a connected cubic graph (regular of degree 3) and e is an edge...
Suppose G is a connected cubic graph (regular of degree 3) and e is an edge such that G − e has two connected components G1 and G2 (a) Explain what connected means. (b) We say that e is a____________ of G (c) show that G1 has an odd number of vertices. (d) draw a connected cubic graph G with an edge e as above.
minimum spanning tree: find a connected subgraph whose total edge cost is minimized (python code)
minimum spanning tree: find a connected subgraph whose total edge cost is minimized (python code)
Give the entire code for Minimum spanning tree using Boruvka's algorithm in java (not copy-pasted from...
Give the entire code for Minimum spanning tree using Boruvka's algorithm in java (not copy-pasted from any other website)
A tree is a circuit-free connected graph. A leaf is a vertex of degree 1 in...
A tree is a circuit-free connected graph. A leaf is a vertex of degree 1 in a tree. Show that every tree T = (V, E) has the following properties: (a) There is a unique path between every pair of vertices. (b) Adding any edge creates a cycle. (c) Removing any edge disconnects the graph. (d) Every tree with at least two vertices has at least two leaves. (e) | V |=| E | +1.
Give an algorithm that constructs an undirected connected graph, which allows for labeling of the n...
Give an algorithm that constructs an undirected connected graph, which allows for labeling of the n vertices u - v <= k for every edge (u,v), where k is some constant. All nodes have a unique label.
Given a connected graph G with n vertices. We say an edge of G is a...
Given a connected graph G with n vertices. We say an edge of G is a bridge if the graph becomes a disconnected graph after removing the edge. Give an O(m + n) time algorithm that finds all the bridges. (Partial credits will be given for a polynomial time algorithm.) (Hint: Use DFS)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT