Click or drag to resize
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.

Inheritance Hierarchy
SystemObject
  Algs4NetDirectedDFS

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class DirectedDFS

The DirectedDFS type exposes the following members.

Constructors
  NameDescription
Public methodDirectedDFS(Digraph, IEnumerableInt32)
Computes the vertices in digraph G that are connected to any of the source vertices sources.
Public methodDirectedDFS(Digraph, Int32)
Computes the vertices in digraph G that are reachable from the source vertex s.
Top
Properties
  NameDescription
Public propertyCount
Returns the number of vertices reachable from the source vertex (or source vertices).
Top
Methods
  NameDescription
Public methodStatic memberMainTest
Demo test the DirectedDFS data type.
Public methodMarked
Is there a directed path from the source vertex (or any of the source vertices) and vertex v?
Top
Remarks

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.

See Also