Depth First Search code.
|
#include "GraphType.h" template<class VertexType> void DepthFirstSearch(GraphType<VertexType>
graph, { using
namespace std; bool
found = false; graph.ClearMarks(); do stack.Pop(vertex); if
(vertex == endVertex) else while
(!vertexQ.IsEmpty()) } } }
while (!stack.IsEmpty() && !found); if
(!found) } |