Suppose you are given a connected graph G, with edge costs that you may assume are all distinct. G has n vertices and m edges. A particular edge e of G is specified. Give an algorithm with running time O(m + n) to decide whether e is contained in a minimum spanning tree of G.
Algorithm:
Theory to prove that it is true:
To understand this, we need to recall the Kruskal's algorithm for MST where we first sort the edges in non decreasing order and then start adding the edges to the solution which does not form the cycle progressively and we take first n-1 edges.
So we can conclude from the Kruskal's algorithm that we can take the edges only which are not a part of cycle and the edge which is the smallest one connecting those two vertices (x,y). That's exactly why we are doing DFS (with considering only the edges weight less than of the given edge) to find that this is the edge(e) which is having minimum weight to connect those two vertices and does not make cycle. Disconnection of the vertices in DFS shows that it does not make cycle.
Note: DFS is Depth First Search and MST is Minimum Spanning Tree.
Solution:
The first question is done as per HOMEWORKLIB RULES, please repost others.
The Kruskal algorithm is best for finding the minimum spanning tree here.
Please have a look at below screenshot which explains the Kruskal with it's running time as well as the correctness proof.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Suppose you are given a connected graph G, with edge costs that you may assume are...
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...
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...
Question 1# (a) Let G be a connected graph and C a non-trivial circuit in G. Prove directly that if an edge e fa, b is removed from C then the subgraph S C G that remains is still connected. "Directly' means using only the definitions of the concepts involved, in this case connected' and 'circuit'. Hint: If z and y are vertices of G connected by path that includes e, is there an alternative path connecting x to y...
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.
er (a) Let G be a connected graph and C a non-trivial circuit in G. Prove directly that if an edge ={a, b} is removed from then the subgraph S CG that remains is still connected. Directly' means using only the definitions of the concepts involved, in this case 'connected' and 'circuit'. Hint: If r and y are vertices of G connected by path that includes e, is there an alternative path connecting x to y that avoids e? (b)...
Question 1: Given an undirected connected graph so that every edge belongs to at least one simple cycle (a cycle is simple if be vertex appears more than once). Show that we can give a direction to every edge so that the graph will be strongly connected. Question 2: Given a graph G(V, E) a set I is an independent set if for every uv el, u #v, uv & E. A Matching is a collection of edges {ei} so...
IN JAVA Given is a weighted undirected graph G = (V, E) with positive weights and a subset of its edges F E. ⊆ E. An F-containing spanning tree of G is a spanning tree that contains all edges from F (there might be other edges as well). Give an algorithm that finds the cost of the minimum-cost F-containing spanning tree of G and runs in time O(m log n) or O(n2). Input: The first line of the text file...
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)...
Other answer is incorrect Problem 1. (15 points) Consider an undirected connected graph G = (V, E) with edge costs ce > 0 for e € E which are all distinct. (a) [8 points). Let E' CE be defined as the following set of edges: for each node v, E' contains the cheapest of all edges incident on v, i.e., the cheapest edge that has v as one of its endpoints. Is the graph (V, E') connected? Is it acyclic?...