Class TarjanOfflineLeastCommonAncestorAlgorithm<TVertex, TEdge>
Offline least common ancestor in a rooted tree.
Inheritance
Inherited Members
Namespace: QuikGraph.Algorithms
Assembly: QuikGraph.dll
Syntax
public sealed class TarjanOfflineLeastCommonAncestorAlgorithm<TVertex, TEdge> : RootedAlgorithmBase<TVertex, IVertexListGraph<TVertex, TEdge>>, IAlgorithm<IVertexListGraph<TVertex, TEdge>>, IComputation, IAlgorithmComponent where TEdge : IEdge<TVertex>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Remarks
Reference: Gabow, H. N. and Tarjan, R. E. 1983. A linear-time algorithm for a special case of disjoint set union. In Proceedings of the Fifteenth Annual ACM Symposium on theory of Computing STOC '83. ACM, New York, NY, 246-251. DOI= http://doi.acm.org/10.1145/800061.808753
Constructors
| Improve this Doc View SourceTarjanOfflineLeastCommonAncestorAlgorithm(IAlgorithmComponent, IVertexListGraph<TVertex, TEdge>)
Initializes a new instance of the TarjanOfflineLeastCommonAncestorAlgorithm<TVertex, TEdge> class.
Declaration
public TarjanOfflineLeastCommonAncestorAlgorithm(IAlgorithmComponent host, IVertexListGraph<TVertex, TEdge> visitedGraph)
Parameters
Type | Name | Description |
---|---|---|
IAlgorithmComponent | host | Host to use if set, otherwise use this reference. |
IVertexListGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
TarjanOfflineLeastCommonAncestorAlgorithm(IVertexListGraph<TVertex, TEdge>)
Initializes a new instance of the TarjanOfflineLeastCommonAncestorAlgorithm<TVertex, TEdge> class.
Declaration
public TarjanOfflineLeastCommonAncestorAlgorithm(IVertexListGraph<TVertex, TEdge> visitedGraph)
Parameters
Type | Name | Description |
---|---|---|
IVertexListGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Properties
| Improve this Doc View SourceAncestors
Ancestors of vertices pairs.
Declaration
public IDictionary<SEquatableEdge<TVertex>, TVertex> Ancestors { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<SEquatableEdge<TVertex>, TVertex> |
Methods
| Improve this Doc View SourceCompute(TVertex, IEnumerable<SEquatableEdge<TVertex>>)
Runs the algorithm with the given root
vertex and set of vertices pairs.
Declaration
public void Compute(TVertex root, IEnumerable<SEquatableEdge<TVertex>> pairs)
Parameters
Type | Name | Description |
---|---|---|
TVertex | root | Root vertex. |
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | pairs | Vertices pairs. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentException |
|
System.ArgumentException |
|
Initialize()
Called on algorithm initialization step.
Declaration
protected override void Initialize()
Overrides
InternalCompute()
Algorithm compute step.
Declaration
protected override void InternalCompute()
Overrides
SetVertexPairs(IEnumerable<SEquatableEdge<TVertex>>)
Sets vertices pairs.
Declaration
public void SetVertexPairs(IEnumerable<SEquatableEdge<TVertex>> pairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | pairs | Vertices pairs. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
TryGetVertexPairs(out IEnumerable<SEquatableEdge<TVertex>>)
Tries to get vertices pairs if set.
Declaration
public bool TryGetVertexPairs(out IEnumerable<SEquatableEdge<TVertex>> pairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | pairs | Vertices pairs if set. |
Returns
Type | Description |
---|---|
System.Boolean | True if vertex pairs were set, false otherwise. |