Breadth First Search code.
|
#include "GraphType.h" template<class VertexType> void BreadthFirstSearch(GraphType<VertexType>
graph, // Assumption: VertexType is a type for
which the == and
{ using
namespace std;
bool
found = false;
graph.ClearMarks();
do
while
(!vertexQ.IsEmpty())
}
}
}
while (!queue.IsEmpty() && !found);
if
(!found)
}
|