Questions tagged [minimum-spanning-tree]

A minimum spanning tree (MST) or minimum weight spanning tree is a spanning tree of a connected, undirected graph with the least possible weight.

A connected, undirected graph can have many different s. We can assign a weight to each edge, which is a number representing how unfavorable it is, and use this to assign a weight to a spanning tree by computing the sum of the weights of the edges in that spanning tree. A minimum spanning tree (MST) or minimum weight spanning tree is then a spanning tree with weight less than or equal to the weight of any other spanning tree. More generally, any undirected graph (not necessarily connected) has a minimum spanning forest, which is a union of minimum spanning trees for its connected components.

One example would be a cable TV company laying cable to a new neighborhood. If it is constrained to bury the cable only along certain paths, then there would be a graph representing which points are connected by those paths. Some of those paths might be more expensive, because they are longer, or require the cable to be buried deeper; these paths would be represented by edges with larger weights. A spanning tree for that graph would be a subset of those paths that has no cycles but still connects to every house. There might be several spanning trees possible. A minimum spanning tree would be one with the lowest total cost.

(Source: Wikipedia)

603 questions
0
votes
1 answer

Describe Algorithm that Decides Whether There are Exactly 2 Different MSTs

Let G = (V, E) be a weighted, connected and undirected graph. Describe an efficient algorithm that decides whether there are exactly 2 different MSTs in G. The previous question which I already solved was a lot easier: Describe an efficient…
0
votes
2 answers

How to run Dijkestra Algorithm to make it similar to Prim and generate an MST?

Let's assume I am running Dijkstra Algorithm to visit all nodes (instead of original initial node and the destination node), i.e. I am checking to see if all nodes are visited or not, instead of the destination node. Will this algorithm generate an…
sheidaei
  • 9,842
  • 20
  • 63
  • 86
0
votes
3 answers

How to turn Prim's algorithm into Kruskal's algorithm?

I've implemented Prim's algorithm in C (www.bubblellicious.es/prim.tar.gz) but I was just wondering how to transform this into Kruskal's algorithm. It seems they're quite similar, but I can't imagine how can I modify my old code into that new one.…
bubblellicious
0
votes
2 answers

Euclidean Minimum Spanning Tree Without Triangulation

I was looking through some text about finding the EMST (Euclidean MST) using Delaunay triangulation technique, but also read somewhere that the EMST can be found through a sweep line algorithm. Since this would easier implementing, I would like to…
0
votes
2 answers

Minimum spanning tree and shortest path

I was given a problem that said: given a connected directed graph with integer weights (both positive and negative), develop an algorithm that finds the shortest path between two vertices. I thought I could use a minimum spanning tree algorithm such…
0
votes
1 answer

What does π[v] ←u step mean in Prims algorithm for minimum spanning tree?

In this MIT video regarding Prims algorithm for minimum spanniing tree the professor explains π[v] ←u at time 71:16 seconds . But I do not understand why we need this step . What does this notation π[v] ←u mean actually ? Also what does the last…
Geek
  • 26,489
  • 43
  • 149
  • 227
0
votes
1 answer

To find the largest edge in the path between two given nodes / vertices

I am trying to update a MST by adding a new vertex in the MST. For this, I have been following "Updating Spanning Tree" by Chin and Houck. http://www.computingscience.nl/docs/vakken/al/WerkC/UpdatingSpanningTrees.pdf A step in the paper requires me…
0
votes
3 answers

How do I find all paths in a sequence of edges in a fast way?

Let E be a given directed edge set. Suppose it is known that the edges in E can form a directed tree T with all the nodes (except the root node) has only 1 in-degree. The problem is how to efficiently traverse the edge set E, in order to find all…
0
votes
2 answers

Prim and Kruskal's algorithms complexity

Given an undirected connected graph with weights. w:E->{1,2,3,4,5,6,7} - meaning there is only 7 weights possible. I need to find a spanning tree using Prim's algorithm in O(n+m) and Kruskal's algorithm in O( m*a(m,n)). I have no idea how to do this…
-1
votes
2 answers

Generate number of edges between two nodes

I generated this Minimum Spanning Tree using Kruskal algorithm and I have a hard time generating paths between two nodes. Can someone help me with pseudocode? I tried using Adjacency List and Adjaceny matrix Loc1 | Loc2 | Distance 02 | 10 | …
-1
votes
0 answers

Which Data structure to use if I want to create a Matrix in Java, where there are 3 columns but unknown number of rows

I want to implement Krushkal's Algorithm in Java. This is not a question on how to implement Krushkal's since I want to try it myself before looking up the code. I have created a Node class and want to create a Graph class. The graph class contains…
-1
votes
1 answer

minimum time to travel between stations

I have implemented a Java program that aims to find the minimum time required to reach each station based on the given bus schedules using Breadth-First Search (BFS). However, the program consistently produces -1 as the output for all stations. I…
-1
votes
1 answer

Fastest Algorithm/Software for MST and Searching on Large Sparse Graphs

I've developed a graph clustering model for assigning destinations to vehicle routes, but my implementation is very slow. It takes about two days to process a graph with 400k nodes. My current implementation in Python is as follows: Input data is a…
-1
votes
2 answers

Linear Time Algorithm to Find MST?

Given 2 Algorithms for a graph G=(V,E): One: Sort edges from lowest to highest weight. Set T = {} for each edge e in the previous order, check if e Union T doesn't have any cycles. If yes, Add e to T. Return T if it's a spanning Tree. Two: Sort…
LOG
  • 45
  • 6
-1
votes
1 answer

Coding MST (4) in CPLEX

I'm trying to code MST4 in CPLEX, but because I'm new to code writing I have difficulty in doing it. I would really appreciate if anyone could help me. Thanks