If we are going to do breadth first search in a graph, and this graph
has cycle, then how can we guarantee the search will end?

Actually, for any kind of graph traversal, how can we make sure we do
not loop forever at somewhere?

What I can think of is to put the node we have examed in a hash, and
each time before exam a new node, check whether we have had it or not
in the hash. 

Any better ideas?
Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to