Computer Science Canada Minimum Spanning Tree of a Graph Solutions |
Author: | whoareyou [ Tue Feb 25, 2014 8:22 pm ] | ||
Post subject: | Minimum Spanning Tree of a Graph Solutions | ||
Hello, I recently wrote a program that implements a slightly modified version of Prim's Algorithm and it seems to work correctly. However, I am doubtful because my prof claims that this certain tree has only 1 minimal solution but my program gives quite a few different solutions (edit: 2 different solutions). 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: SOLUTIONS:
|
Author: | Dreadnought [ Tue Feb 25, 2014 9:25 pm ] |
Post subject: | Re: Minimum Spanning Tree of a Graph Solutions |
I agree, there are two different solutions to this tree. 1) E(T) = {AB, AC, CE, DE, EF, FG} 2) E(T) = {AB, AB, BG, CE, DE, FG} |
Author: | whoareyou [ Tue Feb 25, 2014 10:11 pm ] |
Post subject: | Re: Minimum Spanning Tree of a Graph Solutions |
Dreadnought @ Tue Feb 25, 2014 9:25 pm wrote: 2) E(T) = {AB, AB, BG, CE, DE, FG} I think you meant {AB, AC, BG, CE, DE, FG} but thanks, those are the two solutions the program reported as well. |
Author: | Dreadnought [ Tue Feb 25, 2014 10:44 pm ] |
Post subject: | Re: Minimum Spanning Tree of a Graph Solutions |
whoareyou wrote: I think you meant {AB, AC, BG, CE, DE, FG} but thanks, those are the two solutions the program reported as well.
Ya, that's what I meant, woops! |
Author: | whoareyou [ Tue Feb 25, 2014 11:26 pm ] | ||
Post subject: | RE:Minimum Spanning Tree of a Graph Solutions | ||
Could somebody also confirm that there is only one minimal solution to this graph? My prof seems to hint that there may be more than one solution but my program gives the same solution every time (perhaps he got them switched with the one before? or my program is wrong ): GRAPH: SOLUTIONS:
|
Author: | Tony [ Wed Feb 26, 2014 3:36 am ] |
Post subject: | Re: RE:Minimum Spanning Tree of a Graph Solutions |
whoareyou @ Tue Feb 25, 2014 11:26 pm wrote: only one minimal solution
... SOLUTION__S__ Doesn't this answer the question? |
Author: | whoareyou [ Wed Feb 26, 2014 8:40 am ] |
Post subject: | Re: RE:Minimum Spanning Tree of a Graph Solutions |
Tony @ Wed Feb 26, 2014 3:36 am wrote: whoareyou @ Tue Feb 25, 2014 11:26 pm wrote: only one minimal solution
... SOLUTION__S__ Doesn't this answer the question? No, the output just shows the path starting from each node but I've analyzed each of the paths and they're all the same so I just want some confirmation that there is only one minimal spanning tree since my prof seems to hint that may be the case. Or my algorithm could be messed up. |