Class UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge>
A breath first search algorithm for undirected graphs.
Inheritance
Implements
Inherited Members
Namespace: QuikGraph.Algorithms.Search
Assembly: QuikGraph.dll
Syntax
public sealed class UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge> : RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>, IAlgorithm<IUndirectedGraph<TVertex, TEdge>>, IComputation, IAlgorithmComponent, IUndirectedVertexPredecessorRecorderAlgorithm<TVertex, TEdge>, IUndirectedTreeBuilderAlgorithm<TVertex, TEdge>, IDistanceRecorderAlgorithm<TVertex>, IVertexColorizerAlgorithm<TVertex> where TEdge : IEdge<TVertex>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Constructors
| Improve this Doc View SourceUndirectedBreadthFirstSearchAlgorithm(IAlgorithmComponent, IUndirectedGraph<TVertex, TEdge>, IQueue<TVertex>, IDictionary<TVertex, GraphColor>)
Initializes a new instance of the UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge> class.
Declaration
public UndirectedBreadthFirstSearchAlgorithm(IAlgorithmComponent host, IUndirectedGraph<TVertex, TEdge> visitedGraph, IQueue<TVertex> vertexQueue, 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. |
IQueue<TVertex> | vertexQueue | Queue of vertices to treat. |
System.Collections.Generic.IDictionary<TVertex, GraphColor> | verticesColors | Vertices associated to their colors (treatment states). |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
UndirectedBreadthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge>)
Initializes a new instance of the UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge> class.
Declaration
public UndirectedBreadthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge> visitedGraph)
Parameters
Type | Name | Description |
---|---|---|
IUndirectedGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
UndirectedBreadthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge>, IQueue<TVertex>, IDictionary<TVertex, GraphColor>)
Initializes a new instance of the UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge> class.
Declaration
public UndirectedBreadthFirstSearchAlgorithm(IUndirectedGraph<TVertex, TEdge> visitedGraph, IQueue<TVertex> vertexQueue, IDictionary<TVertex, GraphColor> verticesColors)
Parameters
Type | Name | Description |
---|---|---|
IUndirectedGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
IQueue<TVertex> | vertexQueue | Queue of vertices to treat. |
System.Collections.Generic.IDictionary<TVertex, GraphColor> | verticesColors | Vertices associated to their colors (treatment states). |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
Properties
| Improve this Doc View SourceVerticesColors
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 SourceBlackTarget
Fired when the target vertex of an out-edge from the currently treated vertex is marked as black.
Declaration
public event UndirectedEdgeAction<TVertex, TEdge> BlackTarget
Event Type
Type | Description |
---|---|
UndirectedEdgeAction<TVertex, TEdge> |
DiscoverVertex
Fired when a vertex is discovered and under treatment.
Declaration
public event VertexAction<TVertex> DiscoverVertex
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |
ExamineEdge
Fired when an edge is going to be analyzed.
Declaration
public event EdgeAction<TVertex, TEdge> ExamineEdge
Event Type
Type | Description |
---|---|
EdgeAction<TVertex, TEdge> |
ExamineVertex
Fired when a vertex is going to be analyzed.
Declaration
public event VertexAction<TVertex> ExamineVertex
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |
FinishVertex
Fired when a vertex is fully treated.
Declaration
public event VertexAction<TVertex> FinishVertex
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |
GrayTarget
Fired when the target vertex of an out-edge from the currently treated vertex is marked as gray.
Declaration
public event UndirectedEdgeAction<TVertex, TEdge> GrayTarget
Event Type
Type | Description |
---|---|
UndirectedEdgeAction<TVertex, TEdge> |
InitializeVertex
Fired when a vertex is initialized.
Declaration
public event VertexAction<TVertex> InitializeVertex
Event Type
Type | Description |
---|---|
VertexAction<TVertex> |
NonTreeEdge
Fired when an edge is going to be treated when coming from a gray vertex.
Declaration
public event UndirectedEdgeAction<TVertex, TEdge> NonTreeEdge
Event Type
Type | Description |
---|---|
UndirectedEdgeAction<TVertex, TEdge> |
StartVertex
Fired on a starting vertex once before the start of the search from it.
Declaration
public event VertexAction<TVertex> StartVertex
Event 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> TreeEdge
Event Type
Type | Description |
---|---|
UndirectedEdgeAction<TVertex, TEdge> |