Click or drag to resize
DepthFirstOrder Class

The DepthFirstOrder class represents a data type for determining depth-first search ordering of the vertices in a digraph or edge-weighted digraph, including preorder, postorder, and reverse postorder.

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. Afterwards, the Preorder, Postorder, and Reverse postorder operation takes take time proportional to V.

Inheritance Hierarchy
SystemObject
  Algs4NetDepthFirstOrder

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

The DepthFirstOrder type exposes the following members.

Constructors
  NameDescription
Public methodDepthFirstOrder(Digraph)
Determines a depth-first order for the digraph G.
Public methodDepthFirstOrder(EdgeWeightedDigraph)
Determines a depth-first order for the edge-weighted digraph G.
Top
Methods
  NameDescription
Public methodStatic memberMainTest
Demo test the DepthFirstOrder data type.
Public methodPost
Returns the vertices in postorder.
Public methodPost(Int32)
Returns the postorder number of vertex v.
Public methodPre
Returns the vertices in preorder.
Public methodPre(Int32)
Returns the preorder number of vertex v.
Public methodReversePost
Returns the vertices in reverse postorder.
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 DepthFirstOrder implementation by the respective authors.

See Also