Show / Hide Table of Contents

Class DFS

Implements Depth First Search algorithm for graph traversal.

Inheritance
System.Object
DFS
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: AlgorithmsAndDataStructures.Algorithms.GraphTraversal
Assembly: AlgorithmsAndDataStructures.dll
Syntax
public class DFS

Methods

| Improve this Doc View Source

DFS_Iterative<TValue>(GraphNode<TValue>)

An iterative version of Depth First Search algorithm for traversing a graph that might have cycles.

Declaration
public static List<GraphNode<TValue>> DFS_Iterative<TValue>(GraphNode<TValue> startNode)
Parameters
Type Name Description
GraphNode<TValue> startNode

A node in the graph from which traversal starts.

Returns
Type Description
System.Collections.Generic.List<GraphNode<TValue>>

A sequence of all graph nodes, put into a DFS ordering.

Type Parameters
Name Description
TValue

Type of the values stored in graph nodes.

Remarks

A graph can have many DFS orderings. Each ordering depends on (i) the start node, and (ii) the order by which each node's adjacent nodes are visited.

| Improve this Doc View Source

DFS_Recursive<TValue>(GraphNode<TValue>, List<GraphNode<TValue>>)

A recursive version of Depth First Search algorithm for traversing a graph that might have cycles.

Declaration
public static void DFS_Recursive<TValue>(GraphNode<TValue> startNode, List<GraphNode<TValue>> dfsOrdering)
Parameters
Type Name Description
GraphNode<TValue> startNode

A node in the graph from which traversal starts.

System.Collections.Generic.List<GraphNode<TValue>> dfsOrdering

A sequence of all graph nodes, put into a DFS ordering

Type Parameters
Name Description
TValue

Type of the values stored in graph nodes.

Remarks

A graph can have many DFS orderings. Each ordering depends on (i) the start node, and (ii) the order by which each node's adjacent nodes are visited.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX