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

Inheritance Hierarchy
SystemObject
  Algs4NetDepthFirstPaths

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

The DepthFirstPaths type exposes the following members.

Constructors
  NameDescription
Public methodDepthFirstPaths
Computes a path between s and every other vertex in graph G.
Top
Methods
  NameDescription
Public methodHasPathTo
Is there a path between the source vertex s and vertex v?
Public methodStatic memberMainTest
Demo test the DepthFirstPaths data type.
Public methodPathTo
Returns a path between the source vertex s and vertex v, or null if no such path.
Top
Remarks

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.

See Also