Topologically ordered nodes or layers of a topological order of a graph or of an isolated graph component.
Topologically ordered nodes or layers of a topological order of a graph or of an isolated graph component.
one of NodeT
, N
one of A
or (Int, Iterable[A])
Represents a component of this
graph.
Represents a component of this
graph.
Edges and bridges are computed lazily.
Components will be instantiated by componentTraverser or strongComponentTraverser.
Controls the properties of graph traversals with no specific root and allows
you to produce the (weekly) connected components by a traversal or
call methods like findCycle
that work component-wise.
Represents a cycle in this graph listing the nodes and connecting edges on it with the following syntax:
Represents a cycle in this graph listing the nodes and connecting edges on it with the following syntax:
cycle ::= start-end-node { edge node } edge start-end-node
All nodes and edges on the path are distinct except the start and end nodes that are equal. A cycle contains at least a start node followed by any number of consecutive pairs of an edge and a node and the end node equaling to the start node. The first element is the start node, the second is an edge with its tail being the start node and its head being the third element etc.
Either a Right
containing a valid topological order or a Left
containing a node on a cycle.
Base trait for graph Ordering
s.
Base trait for graph Ordering
s.
Template for extended node visitors.
Template for extended node visitors.
While the default node visitor of the type NodeT => U
passes solely the inner node being visited, extended node visitors
pass the following traversal state information:
Properties and methods for creating modified properties in a fluent-interface manner.
Properties and methods for creating modified properties in a fluent-interface manner.
Controls the properties of inner-edge graph traversals.
Controls the properties of inner-edge graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Controls the properties of inner-element graph traversals.
Controls the properties of inner-element graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Controls the properties of inner-node down-up graph traversals.
Controls the properties of inner-node down-up graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Controls the properties of inner-node graph traversals.
Controls the properties of inner-node graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Represents a topological sort layer.
Layers of a topological order of a graph or of an isolated graph component.
Layers of a topological order of a graph or of an isolated graph component. The layers of a topological sort can roughly be defined as follows:
one of NodeT
, N
The result of a topological sort in the layered view.
Ordering for the path dependent type NodeT.
Ordering for the path dependent type NodeT.
Controls the properties of outer-edge graph traversals.
Controls the properties of outer-edge graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Controls the properties of outer-element graph traversals.
Controls the properties of outer-element graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Controls the properties of outer-node down-up graph traversals.
Controls the properties of outer-node down-up graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Controls the properties of outer-node graph traversals.
Controls the properties of outer-node graph traversals. To start a traversal call one of the graph traversal methods or any appropriate method inherited from scala.collection.Traversable on this instance.
Represents a path in this graph where
Represents a path in this graph where
path
::= node { edge node }
Nodes and edges on the path are distinct. A walk/path contains at least one node followed by any number of consecutive pairs of an edge and a node. The first element is the start node, the second is an edge with its source being the start node and its target being the third element etc.
A Builder
for valid paths in this graph.
A Builder
for valid paths in this graph.
Nodes and edges may be added either alternating or node by node respectively edge by edge. Either way, the builder ensures that the added elements build a valid path.
A node addition fails if either the node to be added is already contained or the node is not a direct successor of the previously added node or of the target node of the previously added edge. An edge addition fails if either the edge to be added is is already contained or the edge is not an outgoing edge from the previously added node or of the target node of the previously added edge.
It is recommended using add
instead of +=
to track failed
additions.
Properties controlling traversals.
Properties controlling traversals.
Controls the properties of graph traversals with no specific root and allows you to produce the strongly connected components by a traversal.
Properties controlling the scope of traversals.
Properties controlling the scope of traversals.
A traversable topological order of nodes of a graph or of an isolated graph component.
A traversable topological order of nodes of a graph or of an isolated graph component.
one of NodeT
, N
Controls the properties of consecutive graph traversals starting at a root node.
Controls the properties of consecutive graph traversals starting at a root node. Provides methods to refine the properties and to invoke traversals. Instances will be created by innerNodeTraverser etc.
The root
-related methods Traverser will inherit.
The root
-related methods Traverser will inherit.
Represents a walk in this graph where walk
::= node { edge node }
A walk/path contains at least one node followed by any number of
consecutive pairs of an edge and a node.
Represents a walk in this graph where walk
::= node { edge node }
A walk/path contains at least one node followed by any number of
consecutive pairs of an edge and a node.
The first element is the start node, the second is an edge with its source
being the start node and its target being the third element etc.
A Builder
for valid walks in this graph.
A Builder
for valid walks in this graph.
Nodes and edges may be added either alternating or node by node respectively edge by edge. Either way, the builder ensures that the added elements build a valid walk.
A node addition fails if the node to be added is not a direct successor of the previously added node or of the target node of the previously added edge. An edge addition fails if the edge to be added is not an outgoing edge from the previously added node or of the target node of the previously added edge.
It is recommended using add
instead of +=
to track failed
additions.
Stores a value and an edge weight function
for use in weight-based traversals that may be defined by withMaxWeight
.
Creates a ComponentTraverser responsible for invoking graph traversal methods in all (weekly) connected components of this possibly disconnected graph.
Creates a ComponentTraverser responsible for invoking graph traversal methods in all (weekly) connected components of this possibly disconnected graph.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
The edge set of this Graph
commonly referred to as E(G).
The edge set of this Graph
commonly referred to as E(G).
Set of all contained edges.
Creates a InnerEdgeTraverser based on scala.collection.Traversable[EdgeT]
.
Creates a InnerEdgeTraverser based on scala.collection.Traversable[EdgeT]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
Creates a InnerElemTraverser based on scala.collection.Traversable[InnerElem]
.
Creates a InnerElemTraverser based on scala.collection.Traversable[InnerElem]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
Creates a InnerNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, NodeT)]
where the Boolean
parameter is true
if the traversal takes
place in downward and false
if it takes place in upward direction.
Creates a InnerNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, NodeT)]
where the Boolean
parameter is true
if the traversal takes
place in downward and false
if it takes place in upward direction.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals. A kind
different from DepthFirst
will be ignored.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
Creates a InnerNodeTraverser based on scala.collection.Traversable[NodeT]
.
Creates a InnerNodeTraverser based on scala.collection.Traversable[NodeT]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
Whether all edges of this graph are directed.
Whether all edges of this graph are directed.
Whether this graph contains at least one hyperedges.
Whether this graph contains at least one hyperedges.
Whether this graph contains at least one multi-edge.
Whether this graph contains at least one multi-edge. We defnie multi-edges by
Instantiates a PathBuilder for this graph.
Instantiates a PathBuilder for this graph.
The node this path starts at.
Expected maximum number of nodes on this path.
Determines the edge to be selected between neighbor nodes if an edge is not supplied explicitly. This is only relevant in case of multigraphs.
Instantiates a WalkBuilder for this graph.
Instantiates a WalkBuilder for this graph.
The node this walk starts at.
Expected maximum number of nodes on this walk.
Determines the edge to be selected between neighbor nodes if an edge is not supplied explicitly. This is only relevant in case of multigraphs.
The node (vertex) set of this Graph
commonly referred to as V(G).
The node (vertex) set of this Graph
commonly referred to as V(G).
Set of all contained nodes.
Creates a OuterEdgeTraverser based on scala.collection.Traversable[E[N]]
.
Creates a OuterEdgeTraverser based on scala.collection.Traversable[E[N]]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
Creates a OuterElemTraverser based on scala.collection.Traversable[OuterElem]
.
Creates a OuterElemTraverser based on scala.collection.Traversable[OuterElem]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
Creates a OuterNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, N)]
where the Boolean
parameter is true
if the traversal takes
place in downward and false
if it takes place in upward direction.
Creates a OuterNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, N)]
where the Boolean
parameter is true
if the traversal takes
place in downward and false
if it takes place in upward direction.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals. A kind
different from DepthFirst
will be ignored.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
Creates a OuterNodeTraverser based on scala.collection.Traversable[N]
.
Creates a OuterNodeTraverser based on scala.collection.Traversable[N]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
Creates a StrongComponentTraverser.
Creates a StrongComponentTraverser.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from NoOrdering
is supplied
neighbor nodes will visited during the traversal according to this ordering.
An optional maximum weight that limits the scope of the traversal or search. If defined and the sum of edge weights between the root of the traversal and a node exceeds the given maximum, that node will no more be visited.
Ordering for the path dependent type EdgeT.
Ordering for the path dependent type EdgeT.
The empty ElemOrdering.
The empty ElemOrdering.
Default edge filter letting path all edges (non-filter).
Default edge filter letting path all edges (non-filter).
An arbitrary edge between from
and to
that is available most efficiently.
An arbitrary edge between from
and to
that is available most efficiently.
Default node filter letting traverse all nodes (non-filter).
Default node filter letting traverse all nodes (non-filter).
Finds a cycle in this
graph in any of its components
and calls visitor
for each inner element visited during the search.
Finds a cycle in this
graph in any of its components
and calls visitor
for each inner element visited during the search.
See componentTraverser
for more control by means of FluentProperties
.
The size - commonly referred to as ||G|| - of this graph equaling to the number of edges.
The size - commonly referred to as ||G|| - of this graph equaling to the number of edges.
Method size
is reserved for the number of nodes and edges
because Graph
is also SetLike
with set elements being nodes or edges.
Populates this graph with nodes
and edges
.
Populates this graph with nodes
and edges
.
The implementing class will typically have a constructor with the same parameters
which is invoked by from
of the companion object.
The isolated (and optionally any other) outer nodes that the node set of this graph is to be populated with.
The outer edges that the edge set of this graph is to be populated with. Nodes being the end of any of these edges will be added to the node set.
Whether this
graph has no cycle.
Whether this
graph has no cycle.
Whether all nodes are pairwise adjacent.
Whether all nodes are pairwise adjacent.
true
if this graph is complete, false
if this graph contains any
independent nodes.
Whether this
graph is connected if it is undirected or
weakly connected if it is directed.
true
if f
is not equivalent to anyEdge
.
true
if f
is not equivalent to anyEdge
.
true
if f
is not equivalent to anyNode
.
true
if f
is not equivalent to anyNode
.
Whether this
graph has at least one cycle in any of its components.
Whether this
graph has at least one cycle in any of its components.
true
if this graph has at most 1 node.
true
if this graph has at most 1 node.
Node predicate always returning false
.
Node predicate always returning false
.
true
if this graph has at least 2 nodes.
true
if this graph has at least 2 nodes.
The order - commonly referred to as |G| - of this graph equaling to the number of nodes.
The order - commonly referred to as |G| - of this graph equaling to the number of nodes.
Sorts this graph topologically.
Sorts this graph topologically.
called for each inner node or inner edge visited during the sort.
See componentTraverser
for more control by means of FluentProperties
.
Sorts every isolated component of this graph topologically.
Sorts every isolated component of this graph topologically.
called for each inner node or inner edge visited during the sort.
See componentTraverser
for more control by means of FluentProperties
.
(graphTraversal: OuterNode[GraphTraversal[N, E]]).toString()
Graph-related functionality such as traversals, path finding, cycle detection etc. All algorithms including breadth-first, depth-first, white-gray-black search and Dijkstra's algorithm are tail recursive.
Before starting a traversal a
Traverser
such as scalax.collection.GraphTraversal#InnerNodeTraverser is instantiated explicitly or implicitly. It holds settings likemaxDepth
,subgraph
orordering
providing a fine-grained control of the traversal.Traverser
s also extendscala.collection.Traversable
meaning that you can process the visited nodes and edges in a functional way.http://www.scala-graph.org/guides/core-traversing