Interface ITraversal<TStart, TEnd>
A traversal represents a directed walk over a graph.
public interface ITraversal<TStart, TEnd> : ITraversal, IEnumerator<TEnd?>, IEnumerator, IDisposable
Type Parameters
TStart
TEnd
- Inherited Members
Methods
HasNext()
Determines if the traversal contains any additional results for iteration.
bool HasNext()
Returns
- bool
True if there are more results and false otherwise.
Iterate()
Iterates all Traverser instances in the traversal.
ITraversal<TStart, TEnd> Iterate()
Returns
- ITraversal<TStart, TEnd>
The fully drained traversal.
Next()
Gets the next result from the traversal.
TEnd? Next()
Returns
- TEnd
The result.
Next(int)
Gets the next n-number of results from the traversal.
IEnumerable<TEnd?> Next(int amount)
Parameters
amount
intThe number of results to get.
Returns
- IEnumerable<TEnd>
The n-results.
NextTraverser()
Gets the next Traverser.
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.
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
.
ToList()
Puts all the results into a IList<T>.
IList<TEnd?> ToList()
Returns
- IList<TEnd>
The results in a list.
ToSet()
Puts all the results into a ISet<T>.
ISet<TEnd?> ToSet()
Returns
- ISet<TEnd>
The results in a set.