Class RootedSearchAlgorithmBase<TVertex, TGraph>
Base class for all graph algorithm performing a search in a graph.
Inheritance
Inherited Members
Namespace: QuikGraph.Algorithms
Assembly: QuikGraph.dll
Syntax
[Serializable]
public abstract class RootedSearchAlgorithmBase<TVertex, TGraph> : RootedAlgorithmBase<TVertex, TGraph>, IAlgorithm<TGraph>, IComputation, IAlgorithmComponent where TGraph : IImplicitVertexSet<TVertex>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TGraph | Graph type. |
Remarks
Requires a starting vertex (root) and an ending vertex (target).
Constructors
| Improve this Doc View SourceRootedSearchAlgorithmBase(IAlgorithmComponent, TGraph)
Initializes a new instance of the RootedSearchAlgorithmBase<TVertex, TGraph> class.
Declaration
protected RootedSearchAlgorithmBase(IAlgorithmComponent host, TGraph visitedGraph)
Parameters
Type | Name | Description |
---|---|---|
IAlgorithmComponent | host | Host to use if set, otherwise use this reference. |
TGraph | visitedGraph | Graph to visit. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Methods
| Improve this Doc View SourceClearTargetVertex()
Clears the target vertex.
Declaration
public void ClearTargetVertex()
Compute(TVertex, TVertex)
Runs the algorithm with the given root
vertex.
Declaration
public void Compute(TVertex root, TVertex target)
Parameters
Type | Name | Description |
---|---|---|
TVertex | root | Root vertex. |
TVertex | target | Target vertex. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentException |
|
System.ArgumentException |
|
System.InvalidOperationException | Something went wrong when running the algorithm. |
OnTargetReached()
Called when the target vertex is reached.
Declaration
protected virtual void OnTargetReached()
OnTargetVertexChanged(EventArgs)
Called on each target vertex change.
Declaration
protected virtual void OnTargetVertexChanged(EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | args | EventArgs.Empty. |
SetTargetVertex(TVertex)
Sets the target vertex.
Declaration
public void SetTargetVertex(TVertex target)
Parameters
Type | Name | Description |
---|---|---|
TVertex | target | Target vertex. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
TryGetTargetVertex(out TVertex)
Tries to get the target vertex if set.
Declaration
public bool TryGetTargetVertex(out TVertex target)
Parameters
Type | Name | Description |
---|---|---|
TVertex | target | Target vertex if set, otherwise null. |
Returns
Type | Description |
---|---|
System.Boolean | True if the target vertex was set, false otherwise. |
Events
| Improve this Doc View SourceTargetReached
Fired when the target vertex is reached.
Declaration
public event EventHandler TargetReached
Event Type
Type | Description |
---|---|
System.EventHandler |
TargetVertexChanged
Fired when the target vertex is changed.
Declaration
public event EventHandler TargetVertexChanged
Event Type
Type | Description |
---|---|
System.EventHandler |