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
0 answers

Minimum to Maximum spanning trees?

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…
user3783608
  • 857
  • 3
  • 11
  • 20
0
votes
1 answer

Find the path and max-weigted edge in a Minimax path-finding solution?

I am currently having a programing assignment: given a large weighted unconnected graph (1 < V < 2000, 0 < E < 100 000). Find the maximum-weighted edge along the minimum-weighted path from "source" to point "destination". What I've got so far is…
0
votes
1 answer

Modifying an Implementation of Prim's to record weight of shortest path c++

I'm having some trouble getting this implementation of Prim's to track the total weight of the shortest path it finds. The path seems to be correct but I can't figure out where to sum the weights as they are added to the array that stores the paths…
Michael
  • 105
  • 1
  • 4
  • 14
0
votes
1 answer

What is PriorityVertex?

What is the type PriorityVertex as seen here? I am also writing a getMinSpanningTree method. Prim's Algorithm
r00t
  • 37
  • 6
0
votes
1 answer

Parallelization of Boruvka's Algorithm

How would I go about parallelizing Boruvka's MST algorithm? I understand that I could find the minimum edge for each node at the same time but how do I guarantee that the nodes selected in parallel are disjoint so that the algorithm works correctly?
0
votes
1 answer

To check if a graph is connected using BFS and print MST

I have stored a graph with nodes 1,2,3,4,... in an adjacency list. I wrote this code to do Breadth First Search (BFS). The BFS works perfect but I don't know what the procedure is to find out if the graph is connected or disconnected and then…
0
votes
0 answers

How to find 4 non intersecting spanning trees in 2D Torus

In my implementation I need to find 4 non intersecting spanning trees in a 2D torus. Assuming all the links are bidirectional. and Bidirectional links are not intersecting. Ex: my 2D torus is of 3 * 3 | | | --0-1-2-- | | | --3-4-5-- | |…
user3447353
  • 1
  • 1
  • 3
0
votes
1 answer

Prim's algorithm for weighted directed graph

I am learning minimum spanning tree. I go through Prim's algorithm for weighted directed graph. Algorithm is simple you have two set of vertices, visited and non-visited set distance for all edges to infinity start with any vertex in non-visited…
Hassan
  • 742
  • 7
  • 13
0
votes
1 answer

Creating a network undirected weighted graph from a binary image for a minimum spanning tree

I'm trying to create a minimum spanning tree between pixels in a thresholded image of a crack. The pixels do not always touch when I remove noise so I am trying to connect them in a graph. Python 2.7 I have thresholded an image so everything that…
0
votes
1 answer

Sparse and Tril functions exceptions

Can anyone explain me why the code below doesnt work and returns me W = [.34 .34 ]; DG = sparse([1 2],[2 3],W); UG = tril(DG + DG') ??? Error using ==> plus Matrix dimensions must agree. and the code below works properly ? W = [.34 .34 .34]; DG =…
hoya21
  • 893
  • 7
  • 24
0
votes
1 answer

Graph Visualization using GraphViz

Playing around graph theory, I implemented Kruskal's algorithm in C++ and used GraphViz for visualization but on running the code to generate the png file with the command : circo -Tpng PairPQ.cpp -o graph.png It shows this : Error: PairPQ.cpp:7:…
0
votes
2 answers

spanning tree including maximum weight

Let G be a weighted undirected graph and e be an edge with maximum weight in G.Suppose there is a minimum weight spanning tree in G containing the edge e.Which of the following statements is always TRUE? a.There exists a cut in g having all edges of…
Xax
  • 185
  • 6
  • 18
0
votes
2 answers

Graph Visualisation

I wrote a java program to calculate the minimum spanning tree with randomly generated 100 vertices and randomly generated 800 edges. I will like to plot the graph that this program generates whenever I run it. Does anybody know of any tool that can…
saopayne
  • 179
  • 3
  • 15
0
votes
0 answers

MST Hadoop IntWritable

I'm Japanese college student. So, I may not be able to speak English well. Now,I study MST,Hadoop. I was referring to this page MST. But, I want to MST in multiple rounds. I want to output each of the edge rather than issue a total edge. So Line…
0
votes
2 answers

Is there any way to quickly find all the edges that are part of a cycle(back edges) in an undirected/directed graph?

I've got a minimum spanning tree. I add an edge to it. Surely a cycle is formed. I need to find all the edges that are part of that cycle ie., all the back edges. How quickly can that be done? My solution- For example if it's edge (1,4), add 4 to…
aandis
  • 4,084
  • 4
  • 29
  • 40