We can find a minimum bottleneck spanning tree in O(E log*V) in the worst case by using Kruskal's algorithm. This is because every minimum spanning tree is a minimum bottleneck spanning tree.
But I got stuck on this job-interview question from this course.
How can we find a minimum bottleneck spanning tree in linear time even in the worst case. Note that we can assume that we can compute the median of n keys in linear time in the worst case.
I found the other answers lacking detail, confusing or plain wrong. For example, ShitalShah's answer states:
Then in his pseudocode later:
"vertices missing from F" or "edges to vertices not in F" is not mentioned in the description immediately preceding the pseudocode. If we let that slide, we soon find more discrepancies:
What? Description and pseudocode were talking about connecting the different connected components using the larger edges, and now we are suddenly filtering them out???
There's more: The link to the actual algorithm returns a 403 forbidden. The Wikipedia article is fraught with similar discrepancies. How do we create a super vertex when they completely degenerate into one vertex per connected component? How to handle parallel edges from partition A after contraction-which one should we choose? $&T^$#)*)
I believe when attempting to provide an answer, we should assume that the reader knows where we live. Thus I present working code, probably the only one found on the web. Drumroll.
I tested it against the following graphs. The first image is from the Wikipedia article, the second from this paper.
The standard algorithm for finding Minimum Bottleneck Spanning Tree (MBST) is known as Camerini’s algorithm. It runs in linear time and is as follows:
In pseudo-code:
Implementation notes:
Update: I've now also created Wikipedia page on this topic.
V
, the median of the weights of the |E| edges.V
, and get the subgraphV
is the upper limit of the answer, and decrease theV
, repeat the step 1, 2.V
, repeat the step 1, 2.Then you can solve the question in linear time.
PS: Using DFS to judge the subgraph is connected. and the complexity is O(E/2) + O(E/4) + O(E/8) + ... = O(E)