Minimum Spanning Tree of a Graph Solutions

AI Thread Summary
A modified version of Prim's Algorithm was implemented to find a minimal spanning tree, yielding a single solution with a total distance of 32. The discussion raises doubts about the existence of multiple solutions, as the professor claims there can be more than one spanning tree. The provided solutions use the same edges but in different orders, which does not constitute a different solution. To resolve the uncertainty, it's suggested to evaluate all possible configurations for total distance and connectedness. This approach could help confirm the validity of the program's output against the professor's assertion.
whoareyou
Messages
162
Reaction score
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
bump, no one can confirm this?
 
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).
 

Similar threads

Replies
1
Views
2K
Replies
3
Views
2K
Replies
1
Views
1K
Replies
5
Views
3K
Replies
8
Views
917
Replies
4
Views
2K
Back
Top