I want to know the vertex order of the Prim algorithm from this graph:
My answer is {a,c,b,e,f,g,d}, but others said {a,c,b,e,d,f,g} or {a,c,d,e,b,f,g}.
{a,c,b,e,f,g,d}
{a,c,b,e,d,f,g}
{a,c,d,e,b,f,g}
Which answer is correct?
Correct!
The minimum spanning tree, if we choose to begin from a is as follows:
a
a -> c -> b-> e -> f -> g | -> d
And the order that we add the vertices to the tree is, as you found out, {a,c,b,e,f,g,d}.
Correct!
The minimum spanning tree, if we choose to begin from
a
is as follows:And the order that we add the vertices to the tree is, as you found out,
{a,c,b,e,f,g,d}
.