DirectedDFS Class |
The DirectedDFS class represents a data type for determining the vertices reachable from a given source vertex S (or set of source vertices) in a digraph. For versions that find the paths, see and .
This implementation uses depth-first search. The constructor takes time proportional to V + E (in the worst case), where V is the number of vertices and E is the number of edges.
Namespace: Algs4Net
public class DirectedDFS
The DirectedDFS type exposes the following members.
Name | Description | |
---|---|---|
![]() | DirectedDFS(Digraph, IEnumerableInt32) |
Computes the vertices in digraph G that are
connected to any of the source vertices sources. |
![]() | DirectedDFS(Digraph, Int32) |
Computes the vertices in digraph G that are
reachable from the source vertex s. |
Name | Description | |
---|---|---|
![]() | Count |
Returns the number of vertices reachable from the source vertex
(or source vertices). |
Name | Description | |
---|---|---|
![]() ![]() | MainTest |
Demo test the DirectedDFS data type. |
![]() | Marked |
Is there a directed path from the source vertex (or any
of the source vertices) and vertex v? |
For additional documentation, see Section 4.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class DirectedDFS implementation by the respective authors.