DFS traversal algorithm
i have No idea how to do this
By modifying the DFS traversal algorithm, write pseudocode for an algorithm that determines whether a graph contains a cycle.
the traversal is wired to touch every node once, or at least thats the usual defination of a traversal (?).
There are several ways to do this, and better ways, but this is the simple one.
Run the traversal, and at every node, create a list of what nodes are 1 step away from the current node. You now have a "map" of the entire graph; from any node, you can now "see" what nodes can be visited next. From that information, you should be able to build a test for a cycle.
By justinsbabe5000 in forum Java
Last Post: 03-17-2009, 12:40 AM
By Peter_APIIT in forum C++
Last Post: 10-10-2008, 11:19 PM
By beamer7296 in forum Java
Last Post: 03-23-2006, 12:13 PM
By shipra pandey in forum Database
Last Post: 02-18-2006, 01:40 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center