Class DefaultTraversal<TStart, TEnd>
A traversal represents a directed walk over a graph.
public abstract class DefaultTraversal<TStart, TEnd> : ITraversal<TStart, TEnd>, ITraversal, IEnumerator<TEnd?>, IEnumerator, IDisposable
Type Parameters
TStart
TEnd
- Inheritance
-
DefaultTraversal<TStart, TEnd>
- Implements
-
ITraversal<TStart, TEnd>IEnumerator<TEnd>
- Derived
- Inherited Members
Constructors
DefaultTraversal()
protected DefaultTraversal()
Properties
Bytecode
Gets the Bytecode representation of this traversal.
public abstract Bytecode Bytecode { get; }
Property Value
Current
public TEnd? Current { get; }
Property Value
- TEnd
IsAnonymous
Determines if this traversal was spawned anonymously or not.
public bool IsAnonymous { get; protected set; }
Property Value
TraversalStrategies
Gets or sets the ITraversalStrategy strategies of this traversal.
protected ICollection<ITraversalStrategy> TraversalStrategies { get; set; }
Property Value
Traversers
Gets or sets the Traverser's of this traversal that hold the results of the traversal.
public IEnumerable<Traverser>? Traversers { get; set; }
Property Value
Methods
Dispose()
public void Dispose()
HasNext()
public bool HasNext()
Returns
Iterate()
Iterates all Traverser instances in the traversal.
public ITraversal<TStart, TEnd> Iterate()
Returns
- ITraversal<TStart, TEnd>
The fully drained traversal.
MoveNext()
public bool MoveNext()
Returns
Next()
Gets the next result from the traversal.
public TEnd? Next()
Returns
- TEnd
The result.
Next(int)
Gets the next n-number of results from the traversal.
public IEnumerable<TEnd?> Next(int amount)
Parameters
amount
intThe number of results to get.
Returns
- IEnumerable<TEnd>
The n-results.
NextTraverser()
Gets the next Traverser.
public Traverser NextTraverser()
Returns
Promise<TReturn>(Func<ITraversal<TStart, TEnd>, TReturn>, CancellationToken)
Starts a promise to execute a function on the current traversal that will be completed in the future.
public Task<TReturn> Promise<TReturn>(Func<ITraversal<TStart, TEnd>, TReturn> callback, CancellationToken cancellationToken = default)
Parameters
callback
Func<ITraversal<TStart, TEnd>, TReturn>The function to execute on the current traversal.
cancellationToken
CancellationTokenThe token to cancel the operation. The default value is None.
Returns
- Task<TReturn>
The result of the executed
callback
.
Type Parameters
TReturn
The return type of the
callback
.
Reset()
Reset is not supported.
public void Reset()
Exceptions
- NotSupportedException
Thrown always as this operation is not supported.
ToList()
Puts all the results into a List<T>.
public IList<TEnd?> ToList()
Returns
- IList<TEnd>
The results in a list.
ToSet()
Puts all the results into a HashSet<T>.
public ISet<TEnd?> ToSet()
Returns
- ISet<TEnd>
The results in a set.