Class UndirectedDepthFirstSearchAlgorithm<TVertex, TEdge>
A depth first search algorithm for undirected graph.
Inheritance
Implements
Inherited Members
Namespace: QuikGraph.Algorithms.Search
Assembly: QuikGraph.dll
Syntax
public sealed class UndirectedDepthFirstSearchAlgorithm<TVertex, TEdge> : RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>, IAlgorithm<IUndirectedGraph<TVertex, TEdge>>, IComputation, IAlgorithmComponent, IDistanceRecorderAlgorithm<TVertex>, IVertexColorizerAlgorithm<TVertex>, IUndirectedVertexPredecessorRecorderAlgorithm<TVertex, TEdge>, IUndirectedTreeBuilderAlgorithm<TVertex, TEdge>, IVertexTimeStamperAlgorithm<TVertex> where TEdge : IEdge<TVertex>Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
| TEdge | Edge type. | 
Constructors
| Improve this Doc View SourceUndirectedDepthFirstSearchAlgorithm(IAlgorithmComponent, IUndirectedGraph<TVertex, TEdge>, IDictionary<TVertex, GraphColor>)
Initializes a new instance of the UndirectedDepthFirstSearchAlgorithm<TVertex, TEdge> class.
Declaration
public UndirectedDepthFirstSearchAlgorithm(IAlgorithmComponent host, IUndirectedGraph<TVertex, TEdge> visitedGraph, IDictionary<TVertex, GraphColor> verticesColors)Parameters
| Type | Name | Description | 
|---|---|---|
| IAlgorithmComponent | host | Host to use if set, otherwise use this reference. | 
| IUndirectedGraph<TVertex, TEdge> | visitedGraph | Graph to visit. | 
| System.Collections.Generic.IDictionary<TVertex, GraphColor> | verticesColors | Vertices associated to their colors (treatment states). | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
UndirectedDepthFirstSearchAlgorithm(IAlgorithmComponent, IUndirectedGraph<TVertex, TEdge>, IDictionary<TVertex, GraphColor>, Func<IEnumerable<TEdge>, IEnumerable<TEdge>>)
Initializes a new instance of the BidirectionalDepthFirstSearchAlgorithm<TVertex, TEdge> class.
Declaration
public UndirectedDepthFirstSearchAlgorithm(IAlgorithmComponent host, IUndirectedGraph<TVertex, TEdge> visitedGraph, IDictionary<TVertex, GraphColor> verticesColors, Func<IEnumerable<TEdge>, IEnumerable<TEdge>> adjacentEdgesFilter)Parameters
| Type | Name | Description | 
|---|---|---|
| IAlgorithmComponent | host | Host to use if set, otherwise use this reference. | 
| IUndirectedGraph<TVertex, TEdge> | visitedGraph | Graph to visit. | 
| System.Collections.Generic.IDictionary<TVertex, GraphColor> | verticesColors | Vertices associated to their colors (treatment states). | 
| System.Func<System.Collections.Generic.IEnumerable<TEdge>, System.Collections.Generic.IEnumerable<TEdge>> | adjacentEdgesFilter | Delegate that takes the enumeration of out-edges and filters/reorders them. All vertices passed to the method should be enumerated once and only once. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
UndirectedDepthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge>)
Initializes a new instance of the UndirectedDepthFirstSearchAlgorithm<TVertex, TEdge> class.
Declaration
public UndirectedDepthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge> visitedGraph)Parameters
| Type | Name | Description | 
|---|---|---|
| IUndirectedGraph<TVertex, TEdge> | visitedGraph | Graph to visit. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
UndirectedDepthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge>, IDictionary<TVertex, GraphColor>)
Initializes a new instance of the UndirectedDepthFirstSearchAlgorithm<TVertex, TEdge> class.
Declaration
public UndirectedDepthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge> visitedGraph, IDictionary<TVertex, GraphColor> verticesColors)Parameters
| Type | Name | Description | 
|---|---|---|
| IUndirectedGraph<TVertex, TEdge> | visitedGraph | Graph to visit. | 
| System.Collections.Generic.IDictionary<TVertex, GraphColor> | verticesColors | Vertices associated to their colors (treatment states). | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
Properties
| Improve this Doc View SourceAdjacentEdgesFilter
Filter of adjacent edges.
Declaration
public Func<IEnumerable<TEdge>, IEnumerable<TEdge>> AdjacentEdgesFilter { get; }Property Value
| Type | Description | 
|---|---|
| System.Func<System.Collections.Generic.IEnumerable<TEdge>, System.Collections.Generic.IEnumerable<TEdge>> | 
MaxDepth
Gets or sets the maximum exploration depth, from the start vertex.
Declaration
public int MaxDepth { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | Maximum exploration depth. | 
Remarks
Defaulted to int.MaxValue.
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentOutOfRangeException | Value is negative or equal to 0. | 
ProcessAllComponents
In case a root vertex has been set, indicates if the algorithm should walk through graph parts of other components than the root component.
Declaration
public bool ProcessAllComponents { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
VerticesColors
Stores vertices associated to their colors (treatment state).
Declaration
public IDictionary<TVertex, GraphColor> VerticesColors { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.IDictionary<TVertex, GraphColor> | 
Methods
| Improve this Doc View SourceGetVertexColor(TVertex)
Gets the GraphColor associated to the given vertex.
Declaration
public GraphColor GetVertexColor(TVertex vertex)Parameters
| Type | Name | Description | 
|---|---|---|
| TVertex | vertex | The vertex. | 
Returns
| Type | Description | 
|---|---|
| GraphColor | The vertex GraphColor. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| VertexNotFoundException | 
 | 
Initialize()
Called on algorithm initialization step.
Declaration
protected override void Initialize()Overrides
InternalCompute()
Algorithm compute step.
Declaration
protected override void InternalCompute()Overrides
Events
| Improve this Doc View SourceBackEdge
Fired when an edge is going to be treated when coming from a gray vertex.
Declaration
public event UndirectedEdgeAction<TVertex, TEdge> BackEdgeEvent Type
| Type | Description | 
|---|---|
| UndirectedEdgeAction<TVertex, TEdge> | 
DiscoverVertex
Fired when a vertex is discovered and under treatment.
Declaration
public event VertexAction<TVertex> DiscoverVertexEvent Type
| Type | Description | 
|---|---|
| VertexAction<TVertex> | 
ExamineEdge
Fired when an edge is going to be analyzed.
Declaration
public event UndirectedEdgeAction<TVertex, TEdge> ExamineEdgeEvent Type
| Type | Description | 
|---|---|
| UndirectedEdgeAction<TVertex, TEdge> | 
FinishVertex
An algorithm that exposes events to compute timing with vertices treatment.
Declaration
public event VertexAction<TVertex> FinishVertexEvent Type
| Type | Description | 
|---|---|
| VertexAction<TVertex> | 
ForwardOrCrossEdge
Fired when an edge is going to be treated when coming from a black vertex.
Declaration
public event UndirectedEdgeAction<TVertex, TEdge> ForwardOrCrossEdgeEvent Type
| Type | Description | 
|---|---|
| UndirectedEdgeAction<TVertex, TEdge> | 
InitializeVertex
Fired when a vertex is initialized.
Declaration
public event VertexAction<TVertex> InitializeVertexEvent Type
| Type | Description | 
|---|---|
| VertexAction<TVertex> | 
StartVertex
Fired on a starting vertex once before the start of the search from it.
Declaration
public event VertexAction<TVertex> StartVertexEvent Type
| Type | Description | 
|---|---|
| VertexAction<TVertex> | 
TreeEdge
Fired when an edge is going to be treated when coming from a white vertex.
Declaration
public event UndirectedEdgeAction<TVertex, TEdge> TreeEdgeEvent Type
| Type | Description | 
|---|---|
| UndirectedEdgeAction<TVertex, TEdge> | 
VertexMaxDepthReached
Fired when the maximal authorized depth is reached.
Declaration
public event VertexAction<TVertex> VertexMaxDepthReachedEvent Type
| Type | Description | 
|---|---|
| VertexAction<TVertex> |