Graph<T> class
A Graph of Nodes.
- Can be generated by
GraphScanner.searchPaths
.
Methods
-
addInput(T nodeValue)
→ Node<T>?
-
Adds a Node to the graph.
Alias to node.
override
-
addOutput(T nodeValue)
→ Node<T>?
-
Adds a Node to the graph.
Alias to node.
override
-
containsInput(T nodeValue)
→ bool
-
Returns
true
if contains a Node with nodeValue
.
See allNodes
override
-
containsOutput(T nodeValue)
→ bool
-
Returns
true
if contains a Node with nodeValue
.
See allNodes
override
-
dispose()
→ void
-
Disposes this graphs, cleaning internal references to this Graph from Nodes.
-
getNode(T? value)
→ Node<T>?
-
Returns a Node with
value
or null
if not present.
-
getNodes(Iterable<T> values)
→ Iterable<Node<T>>
-
Returns a list of Node with
values
present.
-
getNodesNullable(Iterable<T> values)
→ Iterable<Node<T>?>
-
Returns a list of Node with
values
or null
for absent nodes.
-
node(T value)
→ Node<T>
-
Returns a Node with
value
or creates it.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
populate<R>(Iterable<T> entries, {GraphWalkNodeProvider<T>? nodeProvider, GraphWalkOutputsProvider<T>? inputsProvider, GraphWalkOutputsProvider<T>? outputsProvider, GraphWalkNodeProcessor<T, R>? process, int maxExpansion = 3, bool bfs = false})
→ R?
-
Populates this graph with
entries
.
-
populateAsync<R>(Iterable<T> entries, {GraphWalkNodeProviderAsync<T>? nodeProvider, GraphWalkOutputsProviderAsync<T>? inputsProvider, GraphWalkOutputsProviderAsync<T>? outputsProvider, GraphWalkNodeProcessorAsync<T, R>? process, int maxExpansion = 3, bool bfs = false})
→ Future<R?>
-
-
reset()
→ void
-
Resets this graph and all its Nodes for a path scan.
See Node.reset.
override
-
root(T value)
→ Node<T>
-
Returns a Node with
value
or creates it as always root.
-
scanPathsFrom(T root, T target, {bool findAll = false})
→ Future<GraphScanResult<T>>
-
Scans and returns the paths from
root
to target
.
-
scanPathsFromMany(List<T> roots, List<T> targets, {bool? findAll})
→ Future<GraphScanResult<T>>
-
Scans and returns the paths from
roots
to targets
.
-
scanPathsMatching(List<T> roots, NodeMatcher<T> targetMatcher, {bool findAll = true})
→ Future<GraphScanResult<T>>
-
Scans and returns the paths from root to Nodes matching
targetMatcher
.
-
shortestPathsFrom(T root, T target, {bool findAll = false})
→ Future<List<List<Node<T>>>>
-
Returns the shortest paths from
root
to target
.
-
shortestPathsFromMany(List<T> roots, List<T> targets, {bool findAll = false})
→ Future<List<List<Node<T>>>>
-
Returns the shortest paths from
roots
to targets
.
-
shortestPathsMatching(List<T> roots, NodeMatcher<T> targetMatcher, {bool findAll = true})
→ Future<List<List<Node<T>>>>
-
Returns the shortest paths from
roots
to Nodes
matching targetMatcher
.
-
toJson({bool sortByInputDependency = false})
→ Map<String, dynamic>
-
Returns a JSON representation of this graph.
-
toString()
→ String
-
A string representation of this object.
inherited
-
toTree<K>({K keyCast(T value)?, bool sortByInputDependency = false, bool bfs = false})
→ Map<K, dynamic>
-
Returns a Map representation of this graph.
-
toTreeFrom<K>(List<T> roots, {K keyCast(T value)?, bool sortByInputDependency = false, bool bfs = false})
→ Map<K, dynamic>
-
Returns a Map representation of this graph from
roots
.
-
valuesToNodes(Iterable<T> values, {bool createNodes = false})
→ Iterable<Node<T>>
-
Maps
values
to Nodes in this graph.
-
walkInputsFrom<R>(Iterable<T> from, GraphWalkNodeProcessor<T, R> process, {NodeMatcher<T>? stopMatcher, bool processRoots = true, int maxExpansion = 1, bool bfs = false})
→ R?
-
Walk the graph nodes inputs starting
from
and stopping at stopMatcher
(if provided).
-
walkInputsOrderFrom<R>(Iterable<T> from, {NodeMatcher<T>? stopMatcher, bool processRoots = true, int maxExpansion = 1, bool sortByInputDependency = false, bool bfs = false})
→ List<Node<T>>
-
Walk the graph nodes outputs starting
from
and stopping at stopMatcher
(if provided).
-
walkOutputsFrom<R>(Iterable<T> from, GraphWalkNodeProcessor<T, R> process, {NodeMatcher<T>? stopMatcher, bool processRoots = true, int maxExpansion = 1, bool bfs = false})
→ R?
-
Walk the graph nodes outputs starting
from
and stopping at stopMatcher
(if provided).
-
walkOutputsOrderFrom<R>(Iterable<T> from, {NodeMatcher<T>? stopMatcher, bool processRoots = true, int maxExpansion = 1, bool expandSideRoots = false, bool sortByInputDependency = false, bool bfs = false})
→ List<Node<T>>
-
Walk the graph nodes outputs starting
from
and stopping at stopMatcher
(if provided).