I have an undirected, positive-edge-weight graph (V,E) for which I want a minimum spanning tree covering a subset k of vertices V (the Steiner tree problem).
I'm not limiting the size of the spanning tree to k vertices; rather I know exactly which k vertices must be included in the MST.
Starting from the entire MST I could pare down edges/nodes until I get the smallest MST that contains all k.
I can use Prim's algorithm to get the entire MST, and start deleting edges/nodes while the MST of subset k is not destroyed; alternatively I can use Floyd-Warshall to get all-pairs shortest paths and somehow union the paths. Are there better ways to approach this?
If the edge weights are all positive, it suffices to define the MST as the subgraph with minimal total weight that connects all the vertices. The edge weights are all different. If edges can have equal weights, the minimum spanning tree may not be unique.
Explanation: Every MST will contain CD as it is smallest edge. So, Every minimum spanning tree of G must contain CD is true. And G has a unique minimum spanning tree is also true because the graph has edges with distinct weights. So, no minimum spanning tree contains AB is false.
If the graph is not linked, then it finds a Minimum Spanning Tree. Steps for finding MST using Kruskal's Algorithm: Arrange the edge of G in order of increasing weight. Starting only with the vertices of G and proceeding sequentially add each edge which does not result in a cycle, until (n - 1) edges are used.
There's a lot of confusion going on here. Based on what the OP says:
I'm not limiting the size of the spanning tree to k vertices; rather I know exactly which k vertices must be included in the MST.
This is the Steiner tree problem on graphs. This is not the k-MST problem. The Steiner tree problem is defined as such:
Given a weighted graph G = (V, E), a subset S ⊆ V of the vertices, and a root r ∈ V , we want to find a minimum weight tree which connects all the vertices in S to r. 1
As others have mentionned, this problem is NP-hard. Therefore, you can use an approximation algorithm.
Early/Simple Approximation Algorithms
Two famous methods are Takahashi's method and Kruskal's method (both of which have been extended/improved by Rayward-Smith):
Shortest path approximation by Takahashi (with modification by Rayward-Smith)
Kruskal's approximation algorithm (with modification by Rayward-Smith)
Modern/More Advanced Approximation Algorithms
In biology, more recent approaches have treated the problem using the cavity method, which has led to a "modified belief propagation" method that has shown good accuracy on large data sets:
In the context of search engine problems, approaches have focused on efficiency for very large data sets that can be pre-processed to some degree.
The problem you stated is a famous NP-hard problem, called Steiner tree in graphs. There are no known solutions in polynomial time and many believe no such solutions exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With