Determines which connected nodes the traversal has to follow.
The default value is Successors
.
Predicate to filter the nodes to be visited during traversal.
The default value is anyNode
, that is no filtering.
A return of true
signals that the traversal is to be canceled.
Predicate to filter the edges to be visited during traversal.
The default value is anyEdge
meaning that no filtering takes place.
Function to be called on visiting a node for the first time
during a traversal. It can mutate the node or carry out any other side effect.
The default value is the empty function noNodeAction
.
Function to be called on visiting an edge.
It can mutate the node or carry out any other side effect.
The default value is the empty function noEdgeAction
.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Traverses this graph from root
for side-effects allowing
Traverses this graph from root
for side-effects allowing
a) to filter nodes and/or edges, b) to carry out any side effect at visited nodes and/or edges and c) to cancel the traversal at any node.
the node to start the traversal from.
The traversal stops at the first node except for root
for which
this predicate holds true and returns it.
The default value noNode
leads to a full traversal.
If true
the traversal is based on a breath first
(BFS, layer-for-layer) search, otherwise on a depth first search (DFS).
The default value is BFS.
A positive value limits the number of layers for BFS respectively
the number of consecutive child visits before siblings are visited for DFS.
0
- the default - indicates that the traversal should have
an unlimited depth meaning that it will be continued either until
it's canceled by nodeVisitor
or until all nodes have been visited.
the node found if any.
Starting at root
, functionally traverses this graph up to maxDepth
layers
using the breadth first search algorithm and all filters, visitors etc.
Starting at root
, functionally traverses this graph up to maxDepth
layers
using the breadth first search algorithm and all filters, visitors etc.
passed to the encapsulating Traversal
instance.
the node to start the traversal from.
The traversal stops at the first node except for root
for which
this predicate holds true and returns it.
The default value noNode
leads to a full traversal.
A positive value limits the number of layers for BFS respectively
the number of consecutive child visits before siblings are visited for DFS.
0
- the default - indicates that the traversal should have
an unlimited depth meaning that it will be continued either until
it's canceled by nodeVisitor
or until all nodes have been visited.
the node found if any.
Starting at root
, functionally traverses this graph up to maxDepth
layers
using the depth first search algorithm and all filters, visitors etc.
Starting at root
, functionally traverses this graph up to maxDepth
layers
using the depth first search algorithm and all filters, visitors etc.
passed to the encapsulating Traversal
instance.
the node to start the traversal from.
The traversal stops at the first node except for root
for which
this predicate holds true and returns it.
The default value noNode
leads to a full traversal.
A positive value limits the number of layers for BFS respectively
the number of consecutive child visits before siblings are visited for DFS.
0
- the default - indicates that the traversal should have
an unlimited depth meaning that it will be continued either until
it's canceled by nodeVisitor
or until all nodes have been visited.
Function to be called on reaching an already visited node
when moving up in the imaginary tree of a depth first search. Paired with
nodeVisitor
(the 'down-visitor'), this 'up-visitor' enables a stack-wise view of
the traversed nodes.
The default value is the empty function noNodeUpAction
.
This function is called for all nodes from the node found
by pred
back to root
skipping backward along the path from root
to the node found.
the node found if any.
Computes the filtered direct predecessors of node
.
Computes the filtered direct predecessors of node
.
It also calls edgeVisitor
but does not call nodeVisitor
.
the node the direct predecessors are to be calculated of.
function returning whether a specific node has already been visited during the current traversal.
whether to sort in reverse order. Only applicable when ordering
is
different from noOrdering
.
Computes the filtered direct successors of node
.
Computes the filtered direct successors of node
.
It also calls edgeVisitor
but does not call nodeVisitor
.
the node the direct successors are to be calculated of.
function returning whether a specific node has already been visited during the current traversal.
whether to sort in reverse order. Only applicable when ordering
is
different from noOrdering
.
Computes the filtered neighbors of node
.
Computes the filtered neighbors of node
.
It also calls edgeVisitor
but does not call nodeVisitor
.
the node the adjacent are to be calculated of.
function returning whether a specific node has already been visited during the current traversal.
whether to sort in reverse order. Only applicable when ordering
is
different from noOrdering
.
Synonym for breadthFirstSearch
Synonym for breadthFirstSearch
Synonym for depthFirstSearch
Synonym for depthFirstSearch
Abstract class for functional traversals.
In addition to the
traverse
methods defined for nodes, this concept supports repeated traversals with constant direction, filters and visitors. CallnewTraversal
to create an instance and call any subsequent traversals on that instance.