MST theorem proof - data-structures

Let G = (V , E) be a weighted undirected connected graph that contains a cycle, and let e be the maximum-weight edge among all edges in the cycle. I need to prove that there exists a minimum spanning tree of G which does NOT include e.
The idea is intuitively clear and I can show it on a cycle, consisting of 3 nodes. But I do not know how to show that formally for any cycle.

Assume that exists MST with e. Removing e from it, splits tree in two parts. Expecially, it splits cycle nodes into two non empty parts, call them A and B. Since these nodes form a cycle there is at least one more edge between A and B nodes, call it f. Than MST-e+f is a spanning tree with weight less than MST. That means it is not possible to have MST with e.

Related

Is there any minimum spanning tree that contains the maximum-weight edge on some cycle?

The origin problem is from the exercise of Introduction of Algorithm.
23.1-5 Let e be 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 is also a minimum spanning tree of G. That is, there is a minimum spanning tree of G that does not include e.
The question is that: I think the proposition that all the minimum spanning tree of G do not include e is right. The e is the only one maximum-weight edge on some cycle. Is it ?
Update: 2016-10-28 20:21
Add the restriction that e is the only one maximum-weight edge on some cycle.
One test case is when there are nodes labeled 0..n-1 and there are links only between node i and node (i + 1) mod n (that is, a ring). In this case the minimum spanning tree is created by leaving out just one of the links. If e is the unique maximum weight edge it is not in the unique spanning tree, which is all the other links. If there is more than one edge of maximum weight then there are as many different minimum spanning trees as there are edges of maximum weight, each one of them leaving out a different edge of maximum weight and keeping the other ones in.
Consider the case when there is just one edge of maximum weight. Supposing somebody hands you a minimum spanning tree that uses this edge. Delete it from the tree, giving you two disconnected components. Now try adding each of the other edges in the cycle, one at a time. If the edge doesn't connect the two components, delete it again. If any of the edges connect the two components, you have a spanning tree of smaller weight than before, so it can't have been a minimum spanning tree. Can it be the case that none of the edges connect the two components? Adding an edge that doesn't connect the two components doesn't increase the set of nodes reachable from either component, so if no single edge connected the two components, adding all of them at the same time won't. But we know that adding all of these edges adds a path that connects the two nodes connected by the previous maximum weight edge, so one of the edges must connect the components. So our original so-called minimum spanning tree wasn't, and an edge which is of unique maximum weight in a cycle can't be part of a minimum spanning tree.
Your guess is correct:
all the minimum spanning tree of G do not include e is right.
First we need to prove:
e is not a light edge crossing any cut of G.
Let C be any cut that cuts e, since e is in a cycle, so e is not a light edge for any of those cuts, and all the other cuts won't have the edge e crossing it, we won't have that the edge is light for any of those cuts either.
Then we need to prove:
if e is not a light edge crossing any cut of G, then all the minimum spanning tree of G do not include e.
Which is exactly the inverse proposition of 23.1-3.

Minimum spanning tree. unique min edge vs non unique proof

So I have an exercise that I should prove or disprove that:
1) if e is a minimum weight edge in the connected graph G such that not all edges are necessarily distinct, then every minimum spanning tree of G contains e
2) Same as 1) but now all edge weights are distinct.
Ok so intuitively, I understand that for 1) since not all edge weights are distinct, then it's possible that a vertex has the path with edge e but also another edge e_1 such that if weight(e) = weight (e_1) then there is a spanning tree which does not contain the edge e since the graph is connected. Otherwise if both e_1 and e are in the minimum spanning tree, then there is a cycle
and for 2) since all edge weights are distinct, then of course the minimum spanning tree will contain the edge e since any algorithm will always choose the smaller path.
Any suggestions on how to prove these two though? induction? Not sure how to approach.
Actually in your first proof when you say that if both e and e_1 are in G, then there's a cycle, that's not true, because they're minimal edges, so there doesn't have to be a cycle, and you do need to include them both into the MST, because if |E| > 1 and |V| > 2 then they both have to be there.
Anyways, a counter example for the first one is a complete graph with all edges of the same weight as e, the MST will contain only |V|-1 edges, but you didn't include all the other edges of that same weight, hence you have a contradiction.
As for the second one, if all edges are distinct, then if you remove the minimum edge and want to reconstruct the MST, the only way to go about this is to add a an edge connecting the 2 disjoint sets that were broken up by that minimum-weight edge.
Now suppose that you didn't remove that minimum-weight edge, and added that other edge, now you've created a cycle, and since all edges are distinct the cycle-creating edge will be greater than all of them, hence if you remove any former MST edge from that cycle, it will only increase the size of the MST. Which means that pretty much all former MST edges are critical when all edges have distinct weights.

Graph Has Two / Three Different Minimal Spanning Trees ?

I'm trying to find an efficient method of detecting whether a given graph G has two different minimal spanning trees. I'm also trying to find a method to check whether it has 3 different minimal spanning trees. The naive solution that I've though about is running Kruskal's algorithm once and finding the total weight of the minimal spanning tree. Later , removing an edge from the graph and running Kruskal's algorithm again and checking if the weight of the new tree is the weight of the original minimal spanning tree , and so for each edge in the graph. The runtime is O(|V||E|log|V|) which is not good at all, and I think there's a better way to do it.
Any suggestion would be helpful,
thanks in advance
You can modify Kruskal's algorithm to do this.
First, sort the edges by weight. Then, for each weight in ascending order, filter out all irrelevant edges. The relevant edges form a graph on the connected components of the minimum-spanning-forest-so-far. You can count the number of spanning trees in this graph. Take the product over all weights and you've counted the total number of minimum spanning trees in the graph.
You recover the same running time as Kruskal's algorithm if you only care about the one-tree, two-trees, and three-or-more-trees cases. I think you wind up doing a determinant calculation or something to enumerate spanning trees in general, so you likely wind up with an O(MM(n)) worst-case in general.
Suppose you have a MST T0 of a graph. Now, if we can get another MST T1, it must have at least one edge E different from the original MST. Throw away E from T1, now the graph is separated into two components. However, in T0, these two components must be connected, so there will be another edge across this two components that has exactly the same weight as E (or we could substitute the one with more weight with the other one and get a smaller ST). This means substitute this other edge with E will give you another MST.
What this implies is if there are more than one MSTs, we can always change just a single edge from a MST and get another MST. So if you are checking for each edge, try to substitute the edge with the ones with the same weight and if you get another ST it is a MST, you will get a faster algorithm.
Suppose G is a graph with n vertices and m edges; that the weight of any edge e is W(e); and that P is a minimal-weight spanning tree on G, weighing Cost(W,P).
Let δ = minimal positive difference between any two edge weights. (If all the edge weights are the same, then δ is indeterminate; but in this case, any ST is an MST so it doesn't matter.) Take ε such that δ > n·ε > 0.
Create a new weight function U() with U(e)=W(e)+ε when e is in P, else U(e)=W(e). Compute Q, an MST of G under U. If Cost(U,Q) < Cost(U,P) then Q≠P. But Cost(W,Q) = Cost(W,P) by construction of δ and ε. Hence P and Q are distinct MSTs of G under W. If Cost(U,Q) ≥ Cost(U,P) then Q=P and distinct MSTs of G under W do not exist.
The method above determines if there are at least two distinct MSTs, in time O(h(n,m)) if O(h(n,m)) bounds the time to find an MST of G.
I don't know if a similar method can treat whether three (or more) distinct MSTs exist; simple extensions of it fall to simple counterexamples.

Basic Questions about Minimum Spanning Tree

This is not a homework. I am trying to do exercises from a textbook to understand MST (minimum spanning tree).
Suppose I have a cycle C in a weighted undirected graph G. As I understand, the following is correct:
The heaviest edge in C belongs to no MST of G. That is, there is no MST of G, which contains that edge.
The lightest edge in C belongs to some MST of G. That is, there is an MST of G, which contains that edge.
Now I wonder if the followings claims are correct too.
The lightest edge in C belongs to all MST of G. That is, there is no MST of G, which does not contain that edge.
Any edge in C except the heaviest one belongs to some MST. That is, for each edge in C except the heaviest one there is an MST, which contains that edge.
Could you prove the last claim?
Even for the first claim if there are multiple edges which are lightest, all need not be included in the MST.
The first one of your claims is always true. The lightest edge is on the MST for any graph.
The second one is not always true. It is always true if the entire graph is a
cycle and thus every node has 2 edges incident to it. However, in the general case,
an edge (u,v) of weight k is never on MST whenever there is a path between the nodes u and v
connecting them at a total weight less than k.
I don't think your claims are valid. The problem is that you are only considering a cycle in a larger graph.
Consider for example a graph G consisting of 6 nodes in a cycle (with random weights >1). Your claims might hold for that graph but now add 1 node in the center of the graph and connect it with 6 links of cost 1. The MST of your entire graph now will consist of only those 6 edges (which form a star).
If you now look at your claims, you'll see:
The lightest edge in your cycle does not belong to the MST (=star)
None of the edges in the cycle are in the MST

Finding a minimum-bottle neck spanning tree

Hi so i'm doing some test prep and i need to figure out parts b and c. I know part a is true and i can prove it, but finding the algorithms for part b and c is currently eluding me.
Solve the following for a minimum bottleneck tree where the edge with the maximum cost is referred to as the bottleneck.
(a) Is every minimum-bottleneck
spanning tree of G a minimum-spanning tree of G? Prove your claim.
(b) For a given cost c, give an O(n+m)-time algorithm to
find if the bottleneck cost of a minimum-bottleneck spanning tree
of G is not more than c.
(c) Find an algorithm to find a minimum-bottleneck
spanning tree of G.
thanks in advance to anyone who can help me out
For (b):
Erase every edge in G that costs more than c, then check if the left graph is still connected.
For (c):
Do a binary search on c, using the algorithm that solved (b) as the dividing condition.
Proof of (b):
Let's say the graph we got after deleting edges cost more than c from G is G' .
Then:
If G' is connected, then there must be a spanning tree T in G'. Since no edge in G' costs more than c, we can tell for sure that no edge in T costs more than c. Therefore T is a spanning tree for G' and also G whose bottle neck is at most c
If G' is not connected, then there's no spanning tree in G' at all. Since we know every edge in G- G' costs more than c, and we know that any spanning tree of G will contains at least one edge of G- G', therefore we know there's no edge spanning tree of G whose bottle neck <= c
And of course detecting if a graph is connected costs O(n+m)
Proof of (c):
Say, the algorithm we used in (b) is F(G,c) .
Then we have
If F(G,c) = True for some c, then F(G,c') = True for all c' that have c'>=c
If F(G,c) = False for some c, then F(G,c') = False for all c' that have c'<=c
So we can binary search on c :)
Ans. a)False,every minimum bottleneck spanning tree of graph G is not a minimum spanning tree of G.
b)To check whether the value of minimum bottleneck spanning tree is atmost c,you can apply depth first search by selecting any vertex from the set of vertices in graph G.
***Algorithm:***
check_atmostvalue(Graph G,int c)
{
for each vertex v belongs to V[G] do {
visited[v]=false;
}
DFS(v,c); //v is any randomly choosen vertex in Graph G
for each vertex v belongs to V[G] do {
if(visited[v]==false) then
return false;
}
return true;
}
DFS(v,c)
{
visited[v]=true;
for each w adjacent to v do {
if(visited[w]=false and weight(v,w)<=c) then
DFS(w,c);
}
visited[w]=true;
}
This algorithm works in O(V+E) in the worst case as running timr for depth first search DFS is O(V+E).
This problem can be solved by simply finding the MST of the graph. This based on the following claim:
MST is a MBST for a connected graph.
For a MST, choose the maximum edge e in the MST and the edge e divides the MST into two sets S and T. Then from the cut property, edge e must be the minimum weight among those edges that connects S and T.
Then for a MBST, there must be some edge e' that connect S and T. Then w(e') must be no less than w(e). Thus we know that MST must be a MBST.
However, there is another way to determine the minimum bottleneck. We don't need to computer the MBST. In your question, you actually implies the monotocity of the minimum bottleneck. Therefor we can use binary search combined with the connectivity algorithm to find the minimum bottle neck. I haves seen the use of monocity in other cases. I am a bit amazed that the similar technique can be used here!

Resources