DepthFirstPaths Class |
The DepthFirstPaths class represents a data type for finding paths from a source vertex S to every other vertex in an undirected graph.
This implementation uses depth-first search. The constructor takes time proportional to V + E, where V is the number of vertices and E is the number of edges. It uses extra space (not including the graph) proportional to V.
Namespace: Algs4Net
public class DepthFirstPaths
The DepthFirstPaths type exposes the following members.
Name | Description | |
---|---|---|
![]() | DepthFirstPaths | Computes a path between s and every other vertex in graph G. |
Name | Description | |
---|---|---|
![]() | HasPathTo |
Is there a path between the source vertex s and vertex v? |
![]() ![]() | MainTest |
Demo test the DepthFirstPaths data type. |
![]() | PathTo |
Returns a path between the source vertex s and vertex v, or
null if no such path. |
For additional documentation, see Section 4.1 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class DepthFirstPaths implementation by the respective authors.