Click or drag to resize
NonrecursiveDirectedDFS Class

The NonrecursiveDirectedDFS class represents a data type for finding the vertices reachable from a source vertex S in the digraph. This implementation uses a nonrecursive version of depth-first search with an explicit stack.

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 digraph) proportional to V.

Inheritance Hierarchy
SystemObject
  Algs4NetNonrecursiveDirectedDFS

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

The NonrecursiveDirectedDFS type exposes the following members.

Constructors
  NameDescription
Public methodNonrecursiveDirectedDFS
Computes the vertices reachable from the source vertex s in the digraph G.
Top
Methods
  NameDescription
Public methodStatic memberMainTest
Demo test the NonrecursiveDirectedDFS data type.
Public methodMarked
Is vertex v reachable from the source vertex s?
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 NonrecursiveDirectedDFS implementation by the respective authors.

See Also