Satsuma
a delicious .NET graph library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
Public Types | Public Member Functions | Protected Member Functions | Properties | List of all members
Satsuma.Dfs Class Referenceabstract

Performs a customizable depth-first search (DFS). More...

Inherited by Satsuma.Bipartition.MyDfs, Satsuma.ConnectedComponents.MyDfs, Satsuma.FindPathExtensions.PathDfs, Satsuma.LowpointDfs, Satsuma.NetworkSimplex.RecalculatePotentialDfs, Satsuma.NetworkSimplex.UpdatePotentialDfs, Satsuma.StrongComponents.BackwardDfs, Satsuma.StrongComponents.ForwardDfs, and Satsuma.TopologicalOrder.MyDfs.

Public Types

enum  Direction { Undirected, Forward, Backward }
 

Public Member Functions

void Run (IGraph graph, IEnumerable< Node > roots=null)
 Runs the depth-first search. More...
 

Protected Member Functions

virtual bool BackArc (Node node, Arc arc)
 Called when encountering a non-forest arc pointing to an already visited node (this includes loop arcs). More...
 
virtual bool NodeEnter (Node node, Arc arc)
 Called when entering a node through an arc. More...
 
virtual bool NodeExit (Node node, Arc arc)
 Called when exiting a node and going back through an arc. More...
 
abstract void Start (out Direction direction)
 Called before starting the search. More...
 
virtual void StopSearch ()
 Called after finishing the search. More...
 

Properties

IGraph Graph [get, set]
 
int Level [get, set]
 The level of the current node (starting from zero). More...
 

Detailed Description

Performs a customizable depth-first search (DFS).

Definition at line 32 of file Dfs.cs.

Member Enumeration Documentation

Enumerator
Undirected 

The Dfs treats each arc as bidirectional.

Forward 

The Dfs respects the orientation of each arc.

Backward 

The Dfs runs on the reverse graph.

Definition at line 34 of file Dfs.cs.

Member Function Documentation

virtual bool Satsuma.Dfs.BackArc ( Node  node,
Arc  arc 
)
protectedvirtual

Called when encountering a non-forest arc pointing to an already visited node (this includes loop arcs).

Parameters
nodeThe node being processed by the Dfs.
arcThe non-forest arc encountered.
Returns
true if the traversal should continue.

Definition at line 127 of file Dfs.cs.

virtual bool Satsuma.Dfs.NodeEnter ( Node  node,
Arc  arc 
)
protectedvirtual

Called when entering a node through an arc.

Parameters
nodeThe node being entered.
arcThe arc connecting the node to its parent in the Dfs forest, or Arc.Invalid if the node is a root.
Returns
true if the traversal should continue.

Definition at line 113 of file Dfs.cs.

virtual bool Satsuma.Dfs.NodeExit ( Node  node,
Arc  arc 
)
protectedvirtual

Called when exiting a node and going back through an arc.

Parameters
nodeThe node being exited.
arcThe arc connecting the node to its parent in the Dfs forest, or Arc.Invalid if the node is a root.
Returns
true if the traversal should continue.

Definition at line 120 of file Dfs.cs.

void Satsuma.Dfs.Run ( IGraph  graph,
IEnumerable< Node roots = null 
)

Runs the depth-first search.

Can be called an arbitrary number of times.

Parameters
graphThe input graph.
rootsThe roots where the search should start, or null if all the graph nodes should be considered.

Definition at line 55 of file Dfs.cs.

abstract void Satsuma.Dfs.Start ( out Direction  direction)
protectedpure virtual

Called before starting the search.

virtual void Satsuma.Dfs.StopSearch ( )
protectedvirtual

Called after finishing the search.

Definition at line 130 of file Dfs.cs.

Property Documentation

IGraph Satsuma.Dfs.Graph
getsetprotected

Definition at line 44 of file Dfs.cs.

int Satsuma.Dfs.Level
getsetprotected

The level of the current node (starting from zero).

Definition at line 49 of file Dfs.cs.


The documentation for this class was generated from the following file: