2. Let G = (V, E) be an undirected connected graph with n vertices and with an edge-weight function w : E → Z. An edge (u, v) ∈ E is sparkling if it is contained in some minimum spanning tree (MST) of G. The computational problem is to return the set of all sparkling edges in E. Describe an efficient algorithm for this computational problem. You do not need to use pseudocode. What is the asymptotic time complexity of your algorithm?
First of all, please understand that if every edge in graph G have distinct weights, then there will be unique minimum spanning tree and every edge in minimum spanning tree will be sparkling edge. Hence in such case there will be only n-1 sparkling edges.
The only case when there can be more than n-1 sparking edges is when there are multiple edges in a cycle and this edge is maximum weighted edge, then either one of edge can be part of minimum spanning tree and other edge can be discarded. Hence both edges will be sparking edge.
So what we will do here is that, we will compute minimum spanning tree first using either Prim's or Kruskal's algorithm. Hence the edges in this MST are definitely marked as sparkling edge. And then among the edges which are not part of MST T, lets call these set of edges as rejected set R.
So from set R, we will select the edge one by one. Let us say we select edge e, we will see if there is any other edges in MST T which has same weight as R. If none of the edges in MST has same weight as w(e), then reject this edge since e cannot be sparkling edge.
If there is some other edge f in MST, with same weight as w(e), then remove edge f from MST and add edge e into MST. If after removing edge f and adding edge e still make the MST a connected spanning tree over n vertices then mark edge e as sparkling edge since e and f has same weight and are in same cycle and hence selecting either of them makes MST. If removing edge f and adding edge e does not make T as connected spanning tree over |V|=n vertices then 'e' will not be sparkling edge, so remove e and add back edge f into MST.
Do this process over all the rejected vertices and finally at the end we will get all the sparkling edges.
Below is the algorithm:-
SPARKLING_EDGE(G=(V,E))
1. For the given graph G=(V,E) compute MST T //Computing minimum spanning tree T from graph T
2. Sparkling_Edge = EMPTY; //This set will contain list of all sparkling edge at the end
3. For every edge e in T:-
4.........Sparkling_Edge.Add( e ); //Add every edge in T into list of Sparkling Edge
5. Let R = G - T //R contains those edges which are in G but not in MST T. Hence R contains rejected edge.
6. For every edge e in R:-
7............If MST T does not have any edge f with w(f) = w(e):-
8.....................then continue //Since e cannot be sparkling edge, if there is no edge f in T with w(f) == w(e)
9..........else :-
10...................Remove edge f from T and add edge e
11...................If T is connected spanning tree over n vertices:- //Test if removing f and adding e, still connect all vertices
12............................then Sparkling_Edge.Add(e) //This means e and f have same weight in some common cycle
13...................else continue;
14. Return Sparkling_Edge
Time complexity :- Computing MST will take time O(E log E). Then for every edge e, testing them for same weight and checking whether removal of one edge and addition of other leads the tree T connected will take O(E(E+V)) time. Hence total time complexity will be O(E log E) + O(E(E+V)) = O(E2 + EV).
Please comment for any clarification.
2. Let G = (V, E) be an undirected connected graph with n vertices and with...
Let G=(V, E) be a connected graph with a weight w(e) associated with each edge e. Suppose G has n vertices and m edges. Let E’ be a given subset of the edges of E such that the edges of E’ do not form a cycle. (E’ is given as part of input.) Design an O(mlogn) time algorithm for finding a minimum spanning tree of G induced by E’. Prove that your algorithm indeed runs in O(mlogn) time. A minimum...
Problem 4 Let G = (V. E) be an undirected, connected graph with weight function w : E → R. Furthermore, suppose that E 2 |V and that all edge weights are distinct. Prove that the MST of G is unique (that is, that there is only one minimum spanning tree of G).
Problem 5. (15 marks) Given a connected, undirected, weighted graph G- (V, E), define the cost of a spanning tree to be the maximum weight among the weights associated with the edges of the spanning tree. Design an efficient algorithm to find the spanning tree of G which maximize above defined cost What is the complexity of your algorithm.
Let G = (V, E) be a weighted undirected connected graph that contains a cycle. Let k ∈ E be the edge with maximum weight among all edges in the cycle. Prove that G has a minimum spanning tree NOT including k.
Problem 3's picture are given below. 5. (a) Let G = (V, E) be a weighted connected undirected simple graph. For n 1, let cycles in G. Modify {e1, e2,.. . ,en} be a subset of edges (from E) that includes no Kruskal's algorithm in order to obtain a spanning tree of G that is minimal among all the spanning trees of G that include the edges e1, e2, . . . , Cn. (b) Apply your algorithm in (a)...
1) Professor Sabatier conjectures the following converse of Theorem 23.1. Let G=(V,E) be a connected, undirected graph with a real-valued weight function w defined on E. Let A be a subset of E that is included in some minimum spanning tree for G, let (S,V−S) be any cut of G that respects A, and let (u,v) be a safe edge for A crossing (S,V−S). Then, (u,v) is a light edge for the cut. Show that the professor's conjecture is incorrect...
You are given an undirected graph G with weighted edges and a minimum spanning tree T of G. Design an algorithm to update the minimum spanning tree when the weight of a single edge is increased. The input to your algorithm should be the edge e and its new weight: your algorithm should modify T so that it is still a MST. Analyze the running time of your algorithm and prove its correctness.
You are given an undirected graph G with weighted edges and a minimum spanning tree T of G. Design an algorithm to update the minimum spanning tree when the weight of a single edge is decreased. The input to your algorithm should be the edge e and its new weight; your algorithm should modify T so that it is still a MST. Analyze the running time of your algorithm and prove its correctness.
Let G = (V;E) be an undirected and unweighted graph. Let S be a subset of the vertices. The graph induced on S, denoted G[S] is a graph that has vertex set S and an edge between two vertices u, v that is an element of S provided that {u,v} is an edge of G. A subset K of V is called a killer set of G if the deletion of K kills all the edges of G, that is...
Let G be an undirected graph and let X be a subset of the vertices of G. A connecting tree on X is a tree composed out of the edges of G that contains all the vertices in X. One way to compute a connecting tree consists of two steps: (1) Compute a minimum spanning tree T over G. (2) Delete all the edges out of T not needed to connect vertices in X. Give an algorithm(Pseudo-code) to carry out...