module documentation
Provides DFS, DFS_complete, and construct_path functions for depth-first search of a graph.
Function | construct |
Return a list of vertices comprising the directed path from u to v, or an empty list if v is not reachable from u. |
Function | DFS |
Perform DFS of the undiscovered portion of Graph g starting at Vertex u. |
Function |
|
Perform DFS for entire graph and return forest as a dictionary. |
Return a list of vertices comprising the directed path from u to v, or an empty list if v is not reachable from u.
discovered is a dictionary resulting from a previous call to DFS started at u.
Perform DFS of the undiscovered portion of Graph g starting at Vertex u.
discovered is a dictionary mapping each vertex to the edge that was used to discover it during the DFS. (u should be "discovered" prior to the call.) Newly discovered vertices will be added to the dictionary as a result.