scalax.collection.immutable.AdjacencyListGraph
Synonym for incomingFrom
.
Synonym for incomingFrom
.
Synonym for incoming
.
Synonym for incoming
.
Synonym for findIncomingFrom
.
Synonym for findIncomingFrom
.
Synonym for diPredecessors
.
Synonym for diPredecessors
.
All edges connecting this node with other
including outgoing and incoming edges.
All edges connecting this node with other
including outgoing and incoming edges.
This method is useful in case of multigraphs.
A node which is possibly connected with this node.
All edges connecting this node with other
.
If other
equals this node all hooks are returned.
If other
is not connected with this node an empty set is returned.
The Graph
instance this
node is contained in.
The Graph
instance this
node is contained in.
The degree of this node.
The degree of this node.
the number of edges that connect to this node. An edge that connects to this node at more than one ends (loop) is counted as much times as it is connected to this node.
All direct predecessors of this node, also called predecessor set or open in-neighborhood: source nodes of directed incident edges and / or adjacent nodes of undirected incident edges excluding this node.
All direct successors of this node, also called successor set or open out-neighborhood: target nodes of directed incident edges and / or adjacent nodes of undirected incident edges excluding this node.
All direct successors of this node, also called successor set or open out-neighborhood: target nodes of directed incident edges and / or adjacent nodes of undirected incident edges excluding this node.
set of all direct successors of this node.
All edges at this node - commonly denoted as E(v).
All edges at this node - commonly denoted as E(v).
all edges with at least one end connecting to this node.
Finds a node connected with root
by any number of edges with any direction
for which the predicate pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds a node connected with root
by any number of edges with any direction
for which the predicate pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
For directed or mixed graphs the node to be found is weekly connected with this node.
root
itself does not count as a match. This is also true if it has a hook.
If several connected nodes exist with pred
the algorithm selects any one of these.
The predicate which must hold true for the resulting node.
An optional function that is applied for its side-effect to every element visited during graph traversal.
A node with the predicate pred
or None
if either
pred
orFinds a cycle starting the search at root
taking optional filters and visitors into account.
Finds a cycle starting the search at root
taking optional filters and visitors into account., if any.
The resulting cycle may start at any node connected with this
node.
An optional function that is applied for its side-effect to every element visited during graph traversal.
A cycle or None
if either
root
orAn edge at from
having this node as a successor.
An edge at from
having this node as a successor.
The node being at an edge which has this node as a successor.
An edges at from
having this node as a successor.
If from
equals this node a hook may be returned.
If from
is not an adjacent node None
is returned.
An outgoing edge connecting this node with to
.
An outgoing edge connecting this node with to
.
The node which is the end point of an edge starting at this node.
One of possibly several edges connecting this node with to
.
If to
equals this node a hook may be returned.
If to
is not an adjacent node None
is returned.
Finds a predecessor of root
for which the predicate pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds a predecessor of root
for which the predicate pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
root
itself does not count as a match. This is also true if it has a hook.
If several predecessors exist the algorithm selects the first of them found.
The predicate which must hold true for the resulting node.
An optional function that is applied for its side-effect to every element visited during graph traversal.
A node with the predicate pred
or None
if either
pred
orroot
but due to withSubgraph settings this path was out of scope.
Finds a successor of root
for which the predicate pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds a successor of root
for which the predicate pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
root
itself does not count as a match. This is also true if it has a hook.
If several successors holding pred
exist any one of them may be returden.
The predicate which must hold for the resulting node.
An optional function that is applied for its side-effect to every element visited during graph traversal.
A node with the predicate pred
or None
if either
pred
orChecks whether this node has only hooks or no edges at all.
Checks whether potentialPredecessor
is a predecessor of root
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Checks whether potentialPredecessor
is a predecessor of root
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Same as isSuccessorOf
.
The node which is potentially a predecessor of root
.
An optional function that is applied for its side-effect to every element visited during graph traversal.
true
if a path exists from potentialPredecessor
to root
and
it had not to be excluded due to subgraph
properties.
Checks whether potentialSuccessor
is a successor of this node considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Checks whether potentialSuccessor
is a successor of this node considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Same as isPredecessorOf
.
The node which is potentially a successor of this node.
An optional function that is applied for its side-effect to every element visited during graph traversal.
true
if a path exists from this node to potentialSuccessor
and
it had not to be excluded due to a subgraph*
restriction.
The incoming degree of this node.
The incoming degree of this node.
the number of edges that come in to this node including undirected edges. Every loop on this node is counted twice.
Synonym for diPredecessors
.
Synonym for diPredecessors
.
Incoming edges of this node.
All incoming edges connecting from
with this node.
All incoming edges connecting from
with this node.
The node with zero, one or more edges having this node as a direct successor.
All edges at from
having this node as a direct successor.
If from
equals this node all hooks are returned.
If from
is not an adjacent node an empty set is returned.
Instantiates an InnerEdgeTraverser which extends scala.collection.Traversable
with elements of type EdgeT
and sets its root
to this node.
Instantiates an InnerEdgeTraverser which extends scala.collection.Traversable
with elements of type EdgeT
and sets its root
to this node. To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
Instantiates an InnerElemTraverser which extends scala.collection.Traversable
with elements of type InnerElem
and sets its root
to this node.
Instantiates an InnerElemTraverser which extends scala.collection.Traversable
with elements of type InnerElem
and sets its root
to this node. To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
Instantiates an InnerNodeDownUpTraverser which extends scala.collection.Traversable
with elements of type (Boolean, NodeT)
and sets its root
to this node.
Instantiates an InnerNodeDownUpTraverser which extends scala.collection.Traversable
with elements of type (Boolean, NodeT)
and sets its root
to this node.
To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
Instantiates an InnerNodeTraverser which extends scala.collection.Traversable
with elements of type NodeT
and sets its root
to this node.
Instantiates an InnerNodeTraverser which extends scala.collection.Traversable
with elements of type NodeT
and sets its root
to this node. To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
Checks whether potentialConnected
is a node (not necessarily directly)
connected with root
by any number of edges with any direction considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Checks whether potentialConnected
is a node (not necessarily directly)
connected with root
by any number of edges with any direction considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
For directed or mixed graphs it is satisfactory that potentialConnected
is
weekly connected with root
.
The node which is potentially connected with root
.
An optional function that is applied for its side-effect to every element visited during graph traversal.
true
if a path exists from this node to potentialConnected
and
it had not to be excluded due to subgraph
properties.
Whether that
is an adjacent (direct successor) to this node.
Whether that
is independent of this node meaning that
there exists no edge connecting this node with that
.
Returns whether this node's degree equals to 0.
Returns whether this node's degree equals to 0.
Returns whether this node's degree equals to 1.
Returns whether this node's degree equals to 1.
Same as hasSuccessor
.
Same as hasSuccessor
.
Same as hasPredecessor
.
Same as hasPredecessor
.
All adjacent nodes (direct successors and predecessors) of this node, also called open neighborhood excluding this node.
The outgoing degree of this node.
The outgoing degree of this node.
the number of edges that go out from this node including undirected edges. Every loop on this node is counted twice.
Synonym for diSuccessors
.
Synonym for diSuccessors
.
Instantiates an OuterEdgeTraverser which extends scala.collection.Traversable
with elements of type E[N]
and sets its root
to this node.
Instantiates an OuterEdgeTraverser which extends scala.collection.Traversable
with elements of type E[N]
and sets its root
to this node. To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
Instantiates an OuterElemTraverser which extends scala.collection.Traversable
with elements of type OuterElem
and sets its root
to this node.
Instantiates an OuterElemTraverser which extends scala.collection.Traversable
with elements of type OuterElem
and sets its root
to this node. To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
Instantiates an OuterNodeDownUpTraverser which extends scala.collection.Traversable
with elements of type (Boolean, N)
and sets its root
to this node.
Instantiates an OuterNodeDownUpTraverser which extends scala.collection.Traversable
with elements of type (Boolean, N)
and sets its root
to this node.
To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
Instantiates an OuterNodeTraverser which extends scala.collection.Traversable
with elements of type N
and sets its root
to this node.
Instantiates an OuterNodeTraverser which extends scala.collection.Traversable
with elements of type N
and sets its root
to this node. To start a traversal call one of the graph traversal methods or
any appropriate method inherited from scala.collection.Traversable on this instance.
The properties controlling subsequent traversals.
All edges outgoing from this node.
All outgoing edges connecting this node with to
.
All outgoing edges connecting this node with to
.
The node which is the end point of zero, one or more edges starting at this node.
All edges connecting this node with to
.
If to
equals this node all hooks are returned.
If to
is not an adjacent an empty set is returned.
Finds a path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds a path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
The node a path is to be found to.
An optional function that is applied for its side-effect to every element visited during graph traversal.
A path to potentialSuccessor
or None
if either
pred
orFinds a path from root
to a successor of root
for which pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds a path from root
to a successor of root
for which pred
holds considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
root
itself does not count as a match. This is also true if it has a hook.
If several successors exist the algorithm selects any one of these.
The predicate which must hold true for the successor.
An optional function that is applied for its side-effect to every element visited during graph traversal.
A path to a node with the predicate pred
or None
if either
pred
orFinds the shortest path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds the shortest path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method. The calculation is based on the weight of the edges on the path.
Edges have a default weight of 1L
that can be overridden by custom edges.
A weight function yielding any numeric type may also be passed to shortestPathTo
.
The node the shortest path is to be found to.
Function to determine the weight of edges. If supplied, this function takes precedence over edge weights.
The shortest path to potentialSuccessor
or None
if either
potentialSuccessor
orpotentialSuccessor
but due to withSubgraph settings this path was out of scope.
Finds the shortest path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds the shortest path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method. The calculation is based on the weight of the edges on the path.
Edges have a default weight of 1L
that can be overridden by custom edges.
A weight function yielding any numeric type may also be passed to shortestPathTo
.
The node the shortest path is to be found to.
An optional function that is applied for its side-effect to every element visited during graph traversal.
The shortest path to potentialSuccessor
or None
if either
potentialSuccessor
orpotentialSuccessor
but due to withSubgraph settings this path was out of scope.
Finds the shortest path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method.
Finds the shortest path from root
to potentialSuccessor
considering all traversal properties passed to the traverser
factory method like innerNodeTraverser or altered by any with*
method. The calculation is based on the weight of the edges on the path.
Edges have a default weight of 1L
that can be overridden by custom edges.
A weight function yielding any numeric type may also be passed to shortestPathTo
.
The node the shortest path is to be found to.
Function to determine the weight of edges. If supplied, this function takes precedence over edge weights.
An optional function that is applied for its side-effect to every element visited during graph traversal.
The shortest path to potentialSuccessor
or None
if either
potentialSuccessor
orpotentialSuccessor
but due to withSubgraph settings this path was out of scope.
The outer node as supplied by the user at instantiation time or by adding nodes this graph.
Creates a new FluentProperties based on this
except for an updated direction
.
Creates a new FluentProperties based on this
except for an updated direction
.
Creates a new FluentProperties based on this
except for an updated kind
.
Creates a new FluentProperties based on this
except for an updated kind
.
Creates a new FluentProperties based on this
except for an updated maxDepth
.
Creates a new FluentProperties based on this
except for an updated maxDepth
.
Creates a new FluentProperties based on this
except for an updated ordering
.
Creates a new FluentProperties based on this
except for an updated ordering
.
Creates a new FluentProperties based on this
except for an updated parameters
.
Creates a new FluentProperties based on this
except for an updated parameters
.
Creates a new FluentProperties based on this
except for an updated root
.
Creates a new FluentProperties based on this
except for an updated root
.
Creates a new FluentProperties based on this
except for an updated subgraphNodes
and/or subgraphEdges
.
Creates a new FluentProperties based on this
except for an updated subgraphNodes
and/or subgraphEdges
.
Synonym for edges
.
Synonym for edges
.
Synonym for outgoingTo
.
Synonym for outgoingTo
.
Synonym for outgoing
.
Synonym for outgoing
.
Synonym for findOutgoingTo
.
Synonym for findOutgoingTo
.
Synonym for diSuccessors
.
Synonym for diSuccessors
.
Synonym for neighbors
.
Synonym for neighbors
.
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).isDefined
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).isEdge
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).isIn
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).isNode
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).isOut
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).stringPrefix
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).toString()
(innerNodeImpl: OuterNode[This.InnerNodeImpl]).value
(innerNodeImpl: EdgeAssoc[This.InnerNodeImpl]).~(n2)
(innerNodeImpl: EdgeAssoc[This.InnerNodeImpl]).~>(n2)
Traverses this graph starting at this (root) node for side-effects allowing
Traverses this graph starting at this (root) node for side-effects allowing
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. Alternatively, an instance of ExtendedNodeVisitor
may be passed to obtain additional state information such as the current
depth. The concrete type of the last argument, the informer
depends on the underlying implementation so you need to match against it. Concerning this method please match against
scalax.collection.GraphTraversalImpl.DfsInformer or
scalax.collection.GraphTraversalImpl.BfsInformer depending on the
breadthFirst
argument.
Predicate to filter the edges to be visited during traversal.
The default value is anyEdge
meaning that no filtering takes place.
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 limiting the number of layers for Bfs respectively
the number of consecutive child visits before siblings are visited for Dfs.
0
, the default value, indicates that the traversal should have
an unlimited depth meaning that it will be continued until either
it's canceled or all nodes have been visited.
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.
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
.
(Since version 1.8.0) use innerElemTraverser or outerElemTraverser instead.
Traverses this graph starting at this node for side-effects using dfs and applying 'down' and 'up' node visitors to allow computations in a stack-wise manner:
Traverses this graph starting at this node for side-effects using dfs and applying 'down' and 'up' node visitors to allow computations in a stack-wise manner:
val root = "A" val g = Graph(root~>"B1", root~>"B2") val result = ListBuffer.empty[String] (g get root).traverseDownUp()( nodeDown = (n: g.NodeT) => { result. += (if (n == root) "{" else "(") result. += (n.value) Continue }, nodeUp = (n: g.NodeT) => result. += (if (n == root) "}" else ")") ) ("" /: result)(_+_) // yields "{A(B1)(B2)}"
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 an edge.
It can mutate the node or carry out any other side effect.
The default value is the empty function noEdgeAction
.
A positive value limiting the number of layers for Bfs respectively
the number of consecutive child visits before siblings are visited for Dfs.
0
, the default value, indicates that the traversal should have
an unlimited depth meaning that it will be continued until either
it's canceled or all nodes have been visited.
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.
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
. Alternatively, an instance of ExtendedNodeVisitor
may be passed to obtain additional state information such as the current
depth. The concrete type of the last argument, the informer
depends on the underlying implementation so you need to match against it. Concerning this method please match against
scalax.collection.GraphTraversalImpl.DfsInformer.
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
. Alternatively, an instance of ExtendedNodeVisitor
may be passed to obtain additional state information such as the current
depth. The concrete type of the last argument, the informer
depends on the underlying implementation so you need to match against it. Concerning this method please match against
scalax.collection.GraphTraversalImpl.DfsInformer.
(Since version 1.8.0) use innerNodeDownUpTraverser or outerNodeDownUpTraverser instead.
Shortcut for calling 'traverse' with a non-default edgeVisitor
but the default nodeVisitor
allowing a foreach
-like call syntax:
Shortcut for calling 'traverse' with a non-default edgeVisitor
but the default nodeVisitor
allowing a foreach
-like call syntax:
rootNode traverseEdges() { print( if(_.directed) "d" else "u" ) Continue }
(Since version 1.8.0) use innerEdgeTraverser or outerEdgeTraverser instead.
Shortcut for calling traverse
with a non-default nodeVisitor
and
the default edgeVisitor
allowing a foreach
-like call syntax:
Shortcut for calling traverse
with a non-default nodeVisitor
and
the default edgeVisitor
allowing a foreach
-like call syntax:
rootNode traverseNodes() {
print("d" + _.degree)
Continue
}
(Since version 1.8.0) use innerNodeTraverser or outerNodeTraverser instead.