GraphWalker<T> class

Graph walker algorithms.

Constructors

GraphWalker({NodeMatcher<T>? stopMatcher, bool processRoots = true, int maxExpansion = 1, bool sortByInputDependency = false, bool bfs = false, Map<Node<T>, int>? initialProcessedNodes})

Properties

bfs bool
If true will perform a BFS (Breadth-First Search), if false an DFS (Depth-First Search). Default: false (DFS).
final
hashCode int
The hash code for this object.
no setterinherited
maxExpansion int
The maximum expansions that a node can have. Default: 1
final
maxProcessedExpansion int
Returns the maximum expansion count in processedNodes.
no setter
processedNodes Map<Node<T>, int>
latefinal
processRoots bool
If true will process root nodes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sortByInputDependency bool
If true sort nodes by input dependency.
final
stopMatcher NodeMatcher<T>
The NodeMatcher used to stop the walking.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset({bool rollbackToInitialProcessedNodes = true}) → void
toString() String
A string representation of this object.
override
toTreeFrom<K>(List<T> roots, {required GraphWalkNodeProvider<T> nodeProvider, required GraphWalkNodeOutputsProvider<T> outputsProvider, K keyCast(GraphStep<T> step, T value)?}) Map<K, dynamic>
Returns a Map representation of this graph from roots.
walk<R>(Iterable<T> from, {required GraphWalkNodeProvider<T> nodeProvider, required GraphWalkOutputsProvider<T> outputsProvider, required GraphWalkNodeProcessor<T, R> process, int? maxDepth}) → R?
A generic walk algorithm.
walkAsync<R>(Iterable<T> from, {required GraphWalkNodeProviderAsync<T> nodeProvider, required GraphWalkOutputsProviderAsync<T> outputsProvider, required GraphWalkNodeProcessorAsync<T, R> process, int? maxDepth}) Future<R?>
A generic walk algorithm.
walkByNodes<R>(Iterable<Node<T>> from, {required GraphWalkNodeOutputsProvider<T> outputsProvider, required GraphWalkNodeProcessor<T, R> process, GraphWalkSideBranchProcessor<T, R>? processSideBranches, bool expandSideBranches = false, int? maxDepth}) → R?
A generic walk algorithm using Nodes.
walkByNodesAsync<R>(Iterable<Node<T>> from, {required GraphWalkNodeOutputsProviderAsync<T> outputsProvider, required GraphWalkNodeProcessorAsync<T, R> process, GraphWalkSideBranchProcessorAsync<T, R>? processSideBranches, bool expandSideBranches = false, int? maxDepth}) Future<R?>
A generic walk algorithm using Nodes.
walkOrder(List<T> roots, {required GraphWalkNodeProvider<T> nodeProvider, required GraphWalkNodeOutputsProvider<T> outputsProvider, bool expandSideBranches = false, int? maxDepth}) List<Node<T>>
Returns the walk order of nodes.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

extractAllEntries<K, V>(Map<K, V> map, {MapEntry<K, V> entryCaster(MapEntry e)?, bool bfs = false}) List<MapEntry<K, V>>
Extract in depth all the entries of map.

Constants

defaultMaxDepth → const int