Minimum to Maximum spanning trees? - algorithm

I have seen where one can modify classic Mininum spanning tree algorithms to find the Maximum spanning tree instead.
Can an algorithm such as Kruskal's be modified to return a spanning tree that is strictly more costly than an MST, but is the next cheapest. So you can switch one of the edges in this spanning tree, you end up with an MST and vice versa.
I would assume then, that there is a range of spanning trees in terms of their overall cost.
My question is simply how can I find the next cheapest spanning tree, given a graph with an MST.

Related

Two mst in one graph, require exactly the same weights on the edgs?

I need to find two different minimum spanning tree in one graph, I wanted to know if it must be that for every weight of a edge that exists in the first minimum spanning tree there is a edge with the same weight in the second minimum spanning tree.

Given an unweighted graph how do I find a spanning tree with 1. Maximum number of leaves 2 minimum number of leaves

write an algorithm to find a spanning tree that has the maximum number of leaves.
Write an algorithm to find a spanning tree with minimum number of nodes.
I am yet not able to come up with a solution for the following questions.
For the first part what I thought is to find the vertex with the highest degree and place it in the second last level such that the last level gets the maximum number of leaves.
Finding a spanning tree of a graph with maximum number of leaves is an NP-Complete problem. There is a reduction from the Dominating Set Problem which is NP-Complete.
Finding a spanning tree of a graph with minimum number of leaves is also an NP-Complete problem. Suppose if the graph has a Hamiltonian path then the graph has a spanning tree with just two leaves. Thus finding a spanning tree of a graph with minimum number of leaves is equivalent to finding whether a graph has a Hamiltonian path or not.
So for both the problems you need to develop approximation algorithms.

What algorithms are used to find a minimum spanning forest?

As Wikipedia says:
Minimum spanning forest is a union of the minimum spanning trees for
its connected components.
For finding minimum spanning tree we can use for example Prim's algorithm, Kruskal's algorithm, or Borůvka's algorithm.
What algorithm can we use to find minimum spanning forest?
I don't see how you need any other algorithm than you use for trees - you may need to adapt them a bit.
If you use for example Kruskal's algorithm you get all cheapest edges in every sub graph/minimum spanning tree of your (now also minimum spanning) forest. Or you can use Prim's algorithm and if your iteration stops, restart it with a node that is not connected yet (i.e. with another tree).
So my answer in one sentence: "The algorithms used to find a minimum spanning forest are the same ones that are used to find a minimum spanning tree - in some cases with adaptions and in some cases without them."

Spanning Tree VS. Spanning Forest

What's the difference between a Spanning Tree and a Spanning Forest in graphs, conceptually.
Also, is it possible to construct a Spanning Forest through DFS or BFS traversals? Why? How?
I understand the Spanning Tree, but I couldn't find any clear explanations about spanning forests. Even Wikipedia (https://en.wikipedia.org/wiki/Spanning_tree), doesn't give a clear definition about it.
My book (Data Structures & Algorithms, Wiley - sixth edition) also has no definition for spanning forests.
I was wondering, if we have a graph with for example three connected components in it, is it possible to construct a spanning forest by DFS/BFS traversals?
When there is only one connected component in your graph, the spanning tree = spanning forest.
But when there are multiple connected components in your graph. For example in following picture we have 3 connected components.:
So for each component, we will have a spanning tree, and all 3 spanning trees will constitute spanning forest
I was wondering, if we have a graph with for example three connected
components in it, is it possible to construct a spanning forest by
DFS/BFS traversals?
Yes it is possible. When there is only 1 connected component, your BFS or DFS will terminate visiting all the vertices and you will have a spanning tree (which in this case is equal to spanning forest).
But when you have more than 1 connected component, like in the picture, the only thing you have to do is start another BFS or DFS from an unvisited vertex. Your algorithm terminates when there is no unvisited vertex left and each BFS or DFS traversal will yield a spanning tree.
Non-trivial spanning forests can be constructed even for complete graphs via the following algorithm:
preconditions
all vertices are unmarked
the edges are enumerated from 1 to m
edge processing
if both of its adjacent vertices are marked, skip it because then that edge would either merge trees of the forest or creates a cycle in one of its trees
else mark its unmarked adjacent vertices
algorithm
process the edges in the order of their enumeration
explanaton:
while it is feasible in the construction of spanning trees to add edges that "bridge" connected components, those edges are not added in the above algorithm.
interpretation:
if the edges are enumerated according to ascending length, the edges of the resulting spanning forest will be a subsets of the MST and the trees of the forest will resemble "basins" i.e. the length of edges is smallest for the one that created the connected component and increases with every edge that is attached in later steps.
In that case the properties of spanning forest may provide insight into the structural properties of the original graph and/or be utilized in algorithms.

Given a graph G with unique edge weights, are all max spanning trees of G a max bottleneck tree?

The full version of this question is quoted below:
Let G be a connected graph with n vertices, m edges with distinct edge
weights. Let T be a tree of G with n vertices and n-1 edges (i.e. a
spanning tree), and define a bottleneck edge of T to be the edge of T
with the smallest weight. The max-bottleneck tree is a spanning tree
of G if there is no spanning tree with larger bottleneck edge. Prove
or provide a counter example for the following statement:
Every max-spanning tree of G is a max bottleneck tree of G
I think since the graph has unique edge weights, then every spanning tree of G is also unique. Then there is only one maximum spanning tree of G, and if I can prove that this tree is also a max bottle neck tree, then that would prove this statement to be true, but only if it's true for all graphs that have unique edge weights.
I've tried looking for counter examples to prove this false but so far it looks like every graph I draw with unique edge weights winds up have the max spanning tree also be a max bottleneck tree. I think I can use that to prove that this statement is true, but I am not sure how to word it.
Negate all the edge weights in the graph. Then the problems get changed to Minimum Spanning Tree and Minimum Bottleneck Spanning Tree respectively.
Now every Minimum Spanning Tree is also a Minimum Bottleneck Spanning Tree. Proof by Cut Property.
http://flashing-thoughts.blogspot.in/2010/06/everything-about-bottleneck-spanning.html

Resources