Just a quick question,
If i were to alter the general DFS algorithm to do this:
minDFS(Vertex v)
{
if (!v.getVisted())
{
v.setVisited();
Vertex temp = findClosestVertex();
graph.addEdge(v, temp);
minDFS(temp);
}
}
Would I eventually (at the end of DFS) get minimum spanning tree? I know there are other ways of getting the MST (Kruskal's, Prim's etc..),but I was just wondering if this would work.