You can avoid this easily, if you have a numbering of the nodes. A cycle is only counted if all the vertices have a greater numbering than the current vertex.
These are minor implementation details. But DFS is the algorithm for finding cycles.
regards
Arunachalam.
On 10/23/06, malli <[EMAIL PROTECTED]> wrote:
using DFS the loop would get detected more than once.
If we use DFS a loop would be detected 'n' times if there are 'n' nodes
in the loop.
--
===================================
want to know more about me
http"//ww.livejournal.com/users/arunachalam
--~--~---------~--~----~------------~-------~--~----~
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-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---