Show / Hide Table of Contents

Class UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge>

A breath first search algorithm for undirected graphs.

Inheritance
System.Object
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>
UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge>
Implements
IAlgorithm<IUndirectedGraph<TVertex, TEdge>>
IComputation
IAlgorithmComponent
IUndirectedVertexPredecessorRecorderAlgorithm<TVertex, TEdge>
IUndirectedTreeBuilderAlgorithm<TVertex, TEdge>
IDistanceRecorderAlgorithm<TVertex>
IVertexColorizerAlgorithm<TVertex>
Inherited Members
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.TryGetRootVertex(TVertex)
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.SetRootVertex(TVertex)
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.ClearRootVertex()
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.RootVertexChanged
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.OnRootVertexChanged(EventArgs)
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.GetAndAssertRootInGraph()
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.AssertRootInGraph(TVertex)
RootedAlgorithmBase<TVertex, IUndirectedGraph<TVertex, TEdge>>.Compute(TVertex)
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.SyncRoot
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.State
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Compute()
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Abort()
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.StateChanged
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.OnStateChanged(EventArgs)
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Started
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.OnStarted(EventArgs)
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Finished
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.OnFinished(EventArgs)
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Aborted
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.OnAborted(EventArgs)
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.VisitedGraph
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Services
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.GetService<T>()
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.TryGetService<T>(T)
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.TryGetService(Type, Object)
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.ThrowIfCancellationRequested()
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Initialize()
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.InternalCompute()
AlgorithmBase<IUndirectedGraph<TVertex, TEdge>>.Clean()
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: 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 Source

UndirectedBreadthFirstSearchAlgorithm(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

visitedGraph is null.

System.ArgumentNullException

vertexQueue is null.

System.ArgumentNullException

verticesColors is null.

| Improve this Doc View Source

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

visitedGraph is null.

| Improve this Doc View Source

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

visitedGraph is null.

System.ArgumentNullException

vertexQueue is null.

System.ArgumentNullException

verticesColors is null.

Properties

| Improve this Doc View Source

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 Source

GetVertexColor(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

vertex is null.

VertexNotFoundException

vertex has no associated color.

| Improve this Doc View Source

Initialize()

Called on algorithm initialization step.

Declaration
protected override void Initialize()
Overrides
QuikGraph.Algorithms.AlgorithmBase<QuikGraph.IUndirectedGraph<TVertex, TEdge>>.Initialize()
| Improve this Doc View Source

InternalCompute()

Algorithm compute step.

Declaration
protected override void InternalCompute()
Overrides
QuikGraph.Algorithms.AlgorithmBase<QuikGraph.IUndirectedGraph<TVertex, TEdge>>.InternalCompute()

Events

| Improve this Doc View Source

BlackTarget

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>
| Improve this Doc View Source

DiscoverVertex

Fired when a vertex is discovered and under treatment.

Declaration
public event VertexAction<TVertex> DiscoverVertex
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

ExamineEdge

Fired when an edge is going to be analyzed.

Declaration
public event EdgeAction<TVertex, TEdge> ExamineEdge
Event Type
Type Description
EdgeAction<TVertex, TEdge>
| Improve this Doc View Source

ExamineVertex

Fired when a vertex is going to be analyzed.

Declaration
public event VertexAction<TVertex> ExamineVertex
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

FinishVertex

Fired when a vertex is fully treated.

Declaration
public event VertexAction<TVertex> FinishVertex
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

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>
| Improve this Doc View Source

InitializeVertex

Fired when a vertex is initialized.

Declaration
public event VertexAction<TVertex> InitializeVertex
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

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>
| Improve this Doc View Source

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>
| Improve this Doc View Source

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>

Implements

IAlgorithm<TGraph>
IComputation
IAlgorithmComponent
IUndirectedVertexPredecessorRecorderAlgorithm<TVertex, TEdge>
IUndirectedTreeBuilderAlgorithm<TVertex, TEdge>
IDistanceRecorderAlgorithm<TVertex>
IVertexColorizerAlgorithm<TVertex>

Extension Methods

GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, XmlReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, String, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeAndValidateFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String, Action<XmlWriter, TGraph>, Action<XmlWriter, TVertex>, Action<XmlWriter, TEdge>)
  • Improve this Doc
  • View Source
In This Article
Back to top QuikGraph