How to determine if there is a cycle in the graph
If the graph is undirected Bfs + hashtable (bitvector)
If the graph is directed, dfs the tree and each node has a visited value, where 0 is unvisited, 1 is visiting or 2 is finished, you can see clrs p458
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment