Minimum Spanning Tree of a Graph Solutions

In summary, the conversation discusses a program that implements a modified version of Prim's Algorithm to find a minimal spanning tree. The author is doubtful about their solution because their professor claims that there are more than one possible solutions, but the program only outputs one solution. However, the solutions provided in the conversation all have the same total distance and connectedness, indicating that there is only one valid solution. The author is encouraged to evaluate all possible configurations and challenge their professor's claim.
  • #1
whoareyou
162
2
I recently wrote a program that implements a slightly modified version of Prim's Algorithm to find a minimal spanning tree and it seems to work correctly. However, I am doubtful because my prof claims that this certain tree has more than 1 solution but my program gives only one solution. Note that a different solution means that different edges are used to visit every node. Using the same edges in a different order is not a different solution. Can someone please confirm this:

GRAPH:
yah0OL0.png


SOLUTIONS (in each case, all the links are the same, ∴ only 1 solution):
Code:
A -> B: 3
A -> C: 3
C -> D: 3
B -> H: 6
H -> F: 3
H -> I: 4
C -> E: 6
E -> G: 4

TOTAL DISTANCE: 32

B -> A: 3
A -> C: 3
C -> D: 3
B -> H: 6
H -> F: 3
H -> I: 4
C -> E: 6
E -> G: 4

TOTAL DISTANCE: 32

C -> A: 3
C -> D: 3
A -> B: 3
C -> E: 6
E -> G: 4
B -> H: 6
H -> F: 3
H -> I: 4

TOTAL DISTANCE: 32

D -> C: 3
C -> A: 3
A -> B: 3
C -> E: 6
E -> G: 4
B -> H: 6
H -> F: 3
H -> I: 4

TOTAL DISTANCE: 32

E -> G: 4
E -> C: 6
C -> A: 3
C -> D: 3
A -> B: 3
B -> H: 6
H -> F: 3
H -> I: 4

TOTAL DISTANCE: 32

F -> H: 3
H -> I: 4
H -> B: 6
B -> A: 3
A -> C: 3
C -> D: 3
C -> E: 6
E -> G: 4

TOTAL DISTANCE: 32

G -> E: 4
E -> C: 6
C -> A: 3
C -> D: 3
A -> B: 3
B -> H: 6
H -> F: 3
H -> I: 4

TOTAL DISTANCE: 32

H -> F: 3
H -> I: 4
H -> B: 6
B -> A: 3
A -> C: 3
C -> D: 3
C -> E: 6
E -> G: 4

TOTAL DISTANCE: 32

I -> H: 4
H -> F: 3
H -> B: 6
B -> A: 3
A -> C: 3
C -> D: 3
C -> E: 6
E -> G: 4

TOTAL DISTANCE: 32
 
Physics news on Phys.org
  • #2
bump, no one can confirm this?
 
  • #3
To confirm that your solution is the only one, evaluate every possible configuration for total distance and connectedness. Then call your professor's bluff (you should).
 

What is a minimum spanning tree?

A minimum spanning tree is a subset of edges in a weighted graph that connects all the vertices without any cycles and has the minimum possible total weight.

Why is a minimum spanning tree important?

A minimum spanning tree is important because it helps to find the most efficient way to connect all the vertices in a graph while minimizing the total cost or weight. It is used in various applications such as network design, circuit design, and transportation planning.

How is a minimum spanning tree calculated?

There are various algorithms to calculate a minimum spanning tree, such as Prim's algorithm and Kruskal's algorithm. These algorithms use different approaches to find the minimum spanning tree, but they all have a time complexity of O(ElogV) where E is the number of edges and V is the number of vertices in the graph.

What are the properties of a minimum spanning tree?

There are two main properties of a minimum spanning tree: it should have the minimum total weight or cost, and it should not have any cycles. Additionally, a minimum spanning tree is unique for a given graph, and it must have n-1 edges where n is the number of vertices in the graph.

Can a graph have multiple minimum spanning trees?

Yes, a graph can have multiple minimum spanning trees if there are multiple ways to connect all the vertices with the same minimum total weight. This can happen when there are multiple edges with the same weight in the graph, or when there are cycles with the same weight in the graph.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
21
Views
628
  • Engineering and Comp Sci Homework Help
Replies
8
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
962
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
158
  • Engineering and Comp Sci Homework Help
Replies
2
Views
911
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Back
Top