Reputation: 67
I am a bit confused with this example . Normally the depth- first search of a graph is done in alphabetical/ increasing order . (Is it possible for vertex M to be visited third? starting from vertex B ) . Can someone please explain this to me :
Upvotes: 0
Views: 74
Reputation: 17595
Yes, it is possible to visit vertex M as third vertex when starting from B, namely starting at B, then visiting its neighbour A and then visiting A's neighbour M. Note that for depth-first-search, as presented here, there is usually no rule in which order the neighbours of a vertex are visited, such that usually the visiting sequence of the vertices is not uniquely determined.
Upvotes: 1