trait GraphTraversal[N, E[+X] <: EdgeLikeIn[X]] extends GraphBase[N, E]
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 like maxDepth
, subgraph
or ordering
providing a fine-grained control of the traversal. Traverser
s also extend
scala.collection.Iterable
meaning that you can process the visited nodes and edges
in a functional way.
- Self Type
- GraphTraversal[N, E]
- See also
- Alphabetic
- By Inheritance
- GraphTraversal
- GraphBase
- Serializable
- AnyRef
- Any
- by ChainingOps
- by EdgeAssoc
- by anyToNode
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Type Members
- trait Edge extends Serializable
- Definition Classes
- GraphBase
- sealed trait EdgeOrdering extends Ordering[EdgeT] with ElemOrdering
- Definition Classes
- GraphBase
- trait EdgeSet extends AnySet[EdgeT] with ExtSetMethods[EdgeT] with Serializable
- Definition Classes
- GraphBase
- sealed trait ElemOrdering extends AnyRef
Base trait for graph
Ordering
s.Base trait for graph
Ordering
s.- Attributes
- protected
- Definition Classes
- GraphBase
- trait InnerEdge extends Iterable[NodeT] with InnerEdgeParam[N, E, NodeT, E] with Edge with InnerElem
- Definition Classes
- GraphBase
- sealed trait InnerElem extends AnyRef
- Definition Classes
- GraphBase
- trait InnerNode extends InnerNodeParam[N] with Node with InnerElem
- Definition Classes
- GraphBase
- trait Node extends Serializable
- Definition Classes
- GraphBase
- sealed trait NodeOrdering extends Ordering[NodeT] with ElemOrdering
Ordering for the path dependent type NodeT.
Ordering for the path dependent type NodeT.
- Definition Classes
- GraphBase
- trait NodeSet extends AnySet[NodeT] with ExtSetMethods[NodeT]
- Definition Classes
- GraphBase
- sealed abstract class AbstractTopologicalOrder[+A, +T] extends AbstractIterable[T]
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.
- A
one of
NodeT
,N
- T
one of
A
or(Int, Iterable[A])
- abstract class Component extends Properties
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. - abstract class ComponentTraverser extends FluentProperties[ComponentTraverser] with Properties with Iterable[Component]
Controls the properties of graph traversals with no specific root and allows you to produce the (weakly) connected components by a traversal or call methods like
findCycle
that work component-wise. - trait Cycle extends Path
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.
- type EdgeFilter = (EdgeT) => Boolean
- Definition Classes
- GraphBase
- abstract type EdgeSetT <: EdgeSet
- Definition Classes
- GraphBase
- abstract type EdgeT <: InnerEdgeParam[N, E, NodeT, E] with InnerEdge with Serializable
- Definition Classes
- GraphBase
- trait ExtendedNodeVisitor[U] extends (NodeT) => U
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:- the inner node currently visited as with a standard node visitor
- the number of nodes visited so far and
- the current depth in terms of the underlying algorithm and
- a reference to a specific informer that may be pattern matched to collect even further data specific to the implementation.
- abstract class FluentProperties[+This <: FluentProperties[This]] extends AnyRef
Properties and methods for creating modified properties in a fluent-interface manner.
Properties and methods for creating modified properties in a fluent-interface manner.
- Attributes
- protected
- abstract class InnerEdgeTraverser extends TraverserMethods[EdgeT, InnerEdgeTraverser] with Traverser[EdgeT, InnerEdgeTraverser]
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.Iterable on this instance.
- abstract class InnerElemTraverser extends TraverserMethods[InnerElem, InnerElemTraverser] with Traverser[InnerElem, InnerElemTraverser]
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.Iterable on this instance.
- Attributes
- protected
- abstract class InnerNodeDownUpTraverser extends TraverserMethods[(Boolean, NodeT), InnerNodeDownUpTraverser] with Traverser[(Boolean, NodeT), InnerNodeDownUpTraverser]
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.Iterable on this instance.
- abstract class InnerNodeTraverser extends TraverserMethods[NodeT, InnerNodeTraverser] with Traverser[NodeT, InnerNodeTraverser]
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.Iterable on this instance.
- case class Layer(index: Int, _nodes: IndexedSeq[NodeT]) extends Product with Serializable
Represents a topological sort layer.
- final class LayeredTopologicalOrder[+A] extends AbstractTopologicalOrder[A, (Int, Iterable[A])]
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:
- layer 0 contains all nodes having no predecessors,
- layer n contains those nodes that have only predecessors in ancestor layers with at least one of them contained in layer n - 1
- A
one of
NodeT
,N
- type Layers = Iterable[Layer]
The result of a topological sort in the layered view.
- type NodeFilter = (NodeT) => Boolean
- Definition Classes
- GraphBase
- abstract type NodeSetT <: NodeSet
- Definition Classes
- GraphBase
- abstract type NodeT <: TraverserInnerNode
- Definition Classes
- GraphTraversal → GraphBase
- abstract class OuterEdgeTraverser extends TraverserMethods[E[N], OuterEdgeTraverser] with Traverser[E[N], OuterEdgeTraverser]
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.Iterable on this instance.
- trait OuterElemTraverser extends TraverserMethods[OuterElem[N, E], OuterElemTraverser] with Traverser[OuterElem[N, E], OuterElemTraverser]
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.Iterable on this instance.
- abstract class OuterNodeDownUpTraverser extends TraverserMethods[(Boolean, N), OuterNodeDownUpTraverser] with Traverser[(Boolean, N), OuterNodeDownUpTraverser]
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.Iterable on this instance.
- abstract class OuterNodeTraverser extends TraverserMethods[N, OuterNodeTraverser] with Traverser[N, OuterNodeTraverser]
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.Iterable on this instance.
- trait Path extends Walk
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.
- trait PathBuilder extends WalkBuilder with Builder[InnerElem, Path]
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. - trait Properties extends SubgraphProperties
Properties controlling traversals.
Properties controlling traversals.
- Attributes
- protected
- abstract class StrongComponentTraverser extends FluentProperties[StrongComponentTraverser] with Properties with Iterable[Component]
Controls the properties of graph traversals with no specific root and allows you to produce the strongly connected components by a traversal.
- trait SubgraphProperties extends AnyRef
Properties controlling the scope of traversals.
Properties controlling the scope of traversals.
- Attributes
- protected
- final class TopologicalOrder[+A] extends AbstractTopologicalOrder[A, A]
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.
- A
one of
NodeT
,N
- type TopologicalSort = Either[TopologicalSortFailure, TopologicalOrder[NodeT]]
- case class TopologicalSortFailure extends Product with Serializable
Failure result of a topological sort with a possible hint of candidate cycle nodes.
- trait Traverser[A, +This <: Traverser[A, This]] extends TraverserMethods[A, This] with Properties with CompatTraversable[A]
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.
- trait TraverserInnerNode extends InnerNode
- abstract class TraverserMethods[A, +This <: TraverserMethods[A, This]] extends FluentProperties[This]
The
root
-related methods Traverser will inherit.The
root
-related methods Traverser will inherit.- Attributes
- protected
- trait Walk extends Iterable[InnerElem]
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. - trait WalkBuilder extends Builder[InnerElem, Walk] with Growable[InnerElem]
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. - class Weight extends AnyRef
Stores a value and an edge weight function for use in weight-based traversals that may be defined by
withMaxWeight
.
Abstract Value Members
- abstract def componentTraverser(parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): ComponentTraverser
Creates a ComponentTraverser responsible for invoking graph traversal methods in all (weakly) connected components of this possibly disconnected graph.
Creates a ComponentTraverser responsible for invoking graph traversal methods in all (weakly) connected components of this possibly disconnected graph.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
- abstract def edges: EdgeSetT
The edge set of this
Graph
commonly referred to as E(G).The edge set of this
Graph
commonly referred to as E(G).- returns
Set of all contained edges.
- Definition Classes
- GraphBase
- abstract def innerEdgeTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): InnerEdgeTraverser
Creates a InnerEdgeTraverser based on
scala.collection.Iterable[EdgeT]
.Creates a InnerEdgeTraverser based on
scala.collection.Iterable[EdgeT]
.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.
- abstract def innerElemTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): InnerElemTraverser
Creates a InnerElemTraverser based on
scala.collection.Iterable[InnerElem]
.Creates a InnerElemTraverser based on
scala.collection.Iterable[InnerElem]
.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
- abstract def innerNodeDownUpTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): InnerNodeDownUpTraverser
Creates a InnerNodeDownUpTraverser based on
scala.collection.Iterable[(Boolean, NodeT)]
where theBoolean
parameter istrue
if the traversal takes place in downward andfalse
if it takes place in upward direction.Creates a InnerNodeDownUpTraverser based on
scala.collection.Iterable[(Boolean, NodeT)]
where theBoolean
parameter istrue
if the traversal takes place in downward andfalse
if it takes place in upward direction.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals. A
kind
different fromDepthFirst
will be ignored.- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
- abstract def innerNodeTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): InnerNodeTraverser
Creates a InnerNodeTraverser based on
scala.collection.Iterable[NodeT]
.Creates a InnerNodeTraverser based on
scala.collection.Iterable[NodeT]
.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
- abstract def isDirected: Boolean
Whether all edges of this graph are directed.
Whether all edges of this graph are directed.
- Definition Classes
- GraphBase
- abstract def isHyper: Boolean
Whether this graph contains at least one hyperedges.
Whether this graph contains at least one hyperedges.
- Definition Classes
- GraphBase
- abstract def isMixed: Boolean
Whether this graph contains at least one directed and one undirected edge.
Whether this graph contains at least one directed and one undirected edge.
- Definition Classes
- GraphBase
- abstract def isMulti: Boolean
Whether this graph contains at least one multi-edge.
Whether this graph contains at least one multi-edge. We defnie multi-edges by
- two or more directed edges having the same source and target
- two or more undirected edges connecting the same nodes
- two or more (directed) hyperedges that, after being decomposed into (directed) edges, yield any multy-edge as stipulated above.
- Definition Classes
- GraphBase
- abstract def newEdge(innerEdge: E[NodeT]): EdgeT
- Attributes
- protected
- Definition Classes
- GraphBase
- abstract def newNode(n: N): NodeT
- Attributes
- protected
- Definition Classes
- GraphBase
- abstract def newPathBuilder(start: NodeT)(implicit sizeHint: Int = defaultPathSize, edgeSelector: (NodeT, NodeT) => Option[EdgeT] = anyEdgeSelector): PathBuilder
Instantiates a PathBuilder for this graph.
Instantiates a PathBuilder for this graph.
- start
The node this path starts at.
- sizeHint
Expected maximum number of nodes on this path.
- edgeSelector
Determines the edge to be selected between neighbor nodes if an edge is not supplied explicitly. This is only relevant in case of multigraphs.
- abstract def newWalkBuilder(start: NodeT)(implicit sizeHint: Int = defaultPathSize, edgeSelector: (NodeT, NodeT) => Option[EdgeT] = anyEdgeSelector): WalkBuilder
Instantiates a WalkBuilder for this graph.
Instantiates a WalkBuilder for this graph.
- start
The node this walk starts at.
- sizeHint
Expected maximum number of nodes on this walk.
- edgeSelector
Determines the edge to be selected between neighbor nodes if an edge is not supplied explicitly. This is only relevant in case of multigraphs.
- abstract def nodes: NodeSetT
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).- returns
Set of all contained nodes.
- Definition Classes
- GraphBase
- abstract def outerEdgeTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): OuterEdgeTraverser
Creates a OuterEdgeTraverser based on
scala.collection.Iterable[E[N]]
.Creates a OuterEdgeTraverser based on
scala.collection.Iterable[E[N]]
.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
- abstract def outerElemTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): OuterElemTraverser
Creates a OuterElemTraverser based on
scala.collection.Iterable[OuterElem]
.Creates a OuterElemTraverser based on
scala.collection.Iterable[OuterElem]
.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
- abstract def outerNodeDownUpTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): OuterNodeDownUpTraverser
Creates a OuterNodeDownUpTraverser based on
scala.collection.Iterable[(Boolean, N)]
where theBoolean
parameter istrue
if the traversal takes place in downward andfalse
if it takes place in upward direction.Creates a OuterNodeDownUpTraverser based on
scala.collection.Iterable[(Boolean, N)]
where theBoolean
parameter istrue
if the traversal takes place in downward andfalse
if it takes place in upward direction.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals. A
kind
different fromDepthFirst
will be ignored.- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.
- abstract def outerNodeTraverser(root: NodeT, parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): OuterNodeTraverser
Creates a OuterNodeTraverser based on
scala.collection.Iterable[N]
.Creates a OuterNodeTraverser based on
scala.collection.Iterable[N]
.- root
The node where subsequent graph traversals start.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
- abstract def strongComponentTraverser(parameters: Parameters = Parameters(), subgraphNodes: NodeFilter = anyNode, subgraphEdges: EdgeFilter = anyEdge, ordering: ElemOrdering = NoOrdering, maxWeight: Option[Weight] = None): StrongComponentTraverser
Creates a StrongComponentTraverser.
Creates a StrongComponentTraverser.
- parameters
The properties controlling subsequent traversals.
- subgraphNodes
Restricts subsequent graph traversals to visit only nodes holding this predicate.
- subgraphEdges
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
- ordering
If a
NodeOrdering
orEdgeOrdering
different fromNoOrdering
is supplied neighbor nodes will visited during the traversal according to this ordering.- maxWeight
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.
Concrete Value Members
- object Edge extends Serializable
- Definition Classes
- GraphBase
- Annotations
- @transient()
- object EdgeOrdering extends Serializable
Ordering for the path dependent type EdgeT.
Ordering for the path dependent type EdgeT.
- Definition Classes
- GraphBase
- object EdgeT
- Definition Classes
- GraphBase
- Annotations
- @transient()
- object InnerEdge extends Serializable
- Definition Classes
- GraphBase
- Annotations
- @transient()
- object InnerNode extends Serializable
- Definition Classes
- GraphBase
- object NoOrdering extends ElemOrdering with Serializable
The empty ElemOrdering.
The empty ElemOrdering.
- Definition Classes
- GraphBase
- object Node extends Serializable
- Definition Classes
- GraphBase
- Annotations
- @transient()
- object NodeOrdering extends Serializable
- Definition Classes
- GraphBase
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toany2stringadd[GraphTraversal[N, E]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (GraphTraversal[N, E], B)
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toArrowAssoc[GraphTraversal[N, E]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final val anyEdge: EdgeFilter
Default edge filter letting path all edges (non-filter).
Default edge filter letting path all edges (non-filter).
- Definition Classes
- GraphBase
- final def anyEdgeSelector(from: NodeT, to: NodeT): Option[EdgeT]
An arbitrary edge between
from
andto
that is available most efficiently.An arbitrary edge between
from
andto
that is available most efficiently.- Annotations
- @inline()
- final val anyNode: NodeFilter
Default node filter letting traverse all nodes (non-filter).
Default node filter letting traverse all nodes (non-filter).
- Definition Classes
- GraphBase
- final lazy val anyOrdering: AnyOrdering[N]
- Attributes
- protected
- Definition Classes
- GraphBase
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final lazy val defaultEdgeOrdering: EdgeOrdering
- Definition Classes
- GraphBase
- final lazy val defaultNodeOrdering: NodeOrdering
- Definition Classes
- GraphBase
- final def defaultPathSize: Int
- Attributes
- protected
- Annotations
- @inline()
- implicit final def edgeToEdgeCont(e: E[N]): E[NodeT]
- Attributes
- protected
- Definition Classes
- GraphBase
- def ensuring(cond: (GraphTraversal[N, E]) => Boolean, msg: => Any): GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toEnsuring[GraphTraversal[N, E]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (GraphTraversal[N, E]) => Boolean): GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toEnsuring[GraphTraversal[N, E]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toEnsuring[GraphTraversal[N, E]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toEnsuring[GraphTraversal[N, E]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def findCycle[U](implicit visitor: (InnerElem) => U = empty): Option[Cycle]
Finds a cycle in
this
graph in any of its components and callsvisitor
for each inner element visited during the search.Finds a cycle in
this
graph in any of its components and callsvisitor
for each inner element visited during the search. SeecomponentTraverser
for more control by means ofFluentProperties
. - final def findCycleContaining[U](node: NodeT)(implicit visitor: (InnerElem) => U = empty): Option[Cycle]
Finds a cycle that contains
node
and callsvisitor
for each inner element visited during the search. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def graphSize: Int
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 becauseGraph
is alsoSetLike
with set elements being nodes or edges.- Definition Classes
- GraphBase
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def initialize(nodes: Iterable[N], edges: Iterable[E[N]]): Unit
Populates this graph with
nodes
andedges
.Populates this graph with
nodes
andedges
.The implementing class will typically have a constructor with the same parameters which is invoked by
from
of the companion object.- nodes
The isolated (and optionally any other) outer nodes that the node set of this graph is to be populated with.
- edges
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.
- Attributes
- protected
- Definition Classes
- GraphBase
- final def isAcyclic: Boolean
Whether
this
graph has no cycle.Whether
this
graph has no cycle.- Annotations
- @inline()
- def isComplete: Boolean
Whether all nodes are pairwise adjacent.
Whether all nodes are pairwise adjacent.
- returns
true
if this graph is complete,false
if this graph contains any independent nodes.
- def isConnected: Boolean
Whether
this
graph is connected if it is undirected or weakly connected if it is directed. - final def isCustomEdgeFilter(f: EdgeFilter): Boolean
true
iff
is not equivalent toanyEdge
.true
iff
is not equivalent toanyEdge
.- Definition Classes
- GraphBase
- Annotations
- @inline()
- final def isCustomNodeFilter(f: NodeFilter): Boolean
true
iff
is not equivalent toanyNode
.true
iff
is not equivalent toanyNode
.- Definition Classes
- GraphBase
- Annotations
- @inline()
- final def isCyclic: Boolean
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.- Annotations
- @inline()
- def isDefined: Boolean
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- Param
- final def isEdge: Boolean
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- Param
- def isIn: Boolean
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- InParam → Param
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isNode: Boolean
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- NodeParam
- final def isOut: Boolean
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- Param
- final def isTrivial: Boolean
true
if this graph has at most 1 node.true
if this graph has at most 1 node.- Definition Classes
- GraphBase
- Annotations
- @inline()
- val n1: GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toEdgeAssoc[GraphTraversal[N, E]] performed by method EdgeAssoc in scalax.collection.GraphPredef.
- Definition Classes
- EdgeAssoc
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final val noNode: NodeFilter
Node predicate always returning
false
.Node predicate always returning
false
.- Definition Classes
- GraphBase
- final def nonTrivial: Boolean
true
if this graph has at least 2 nodes.true
if this graph has at least 2 nodes.- Definition Classes
- GraphBase
- Annotations
- @inline()
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def order: Int
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.
- Definition Classes
- GraphBase
- def pipe[B](f: (GraphTraversal[N, E]) => B): B
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toChainingOps[GraphTraversal[N, E]] performed by method ChainingOps in scalax.collection.
- Definition Classes
- ChainingOps
- def productElementNames: Iterator[String]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- Product
- val self: GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toChainingOps[GraphTraversal[N, E]] performed by method ChainingOps in scalax.collection.
- Definition Classes
- ChainingOps
- def stringPrefix: String
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- NodeParam
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def tap[U](f: (GraphTraversal[N, E]) => U): GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toChainingOps[GraphTraversal[N, E]] performed by method ChainingOps in scalax.collection.
- Definition Classes
- ChainingOps
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def topologicalSort[U](implicit visitor: (InnerElem) => U = empty): TopologicalSort
Sorts this graph topologically.
Sorts this graph topologically. Hooks are ignored.
- visitor
called for each inner node or inner edge visited during the sort. See
componentTraverser
for more control by means ofFluentProperties
.
- final def topologicalSortByComponent[U](implicit visitor: (InnerElem) => U = empty): Iterable[TopologicalSort]
Sorts every isolated component of this graph topologically.
Sorts every isolated component of this graph topologically. Hooks are ignored.
- visitor
called for each inner node or inner edge visited during the sort. See
componentTraverser
for more control by means ofFluentProperties
.
- def totalWeight: Double
- Definition Classes
- GraphBase
- val value: GraphTraversal[N, E]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Definition Classes
- OuterNode → NodeParam
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def ~[N >: N1](n2: N): UnDiEdge[N]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toEdgeAssoc[GraphTraversal[N, E]] performed by method EdgeAssoc in scalax.collection.GraphPredef.
- Definition Classes
- EdgeAssoc
- Annotations
- @inline()
- def ~>[N >: N1](n2: N): DiEdge[N]
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toEdgeAssoc[GraphTraversal[N, E]] performed by method EdgeAssoc in scalax.collection.GraphPredef.
- Definition Classes
- EdgeAssoc
- Annotations
- @inline()
- object Cycle
- object ExtendedNodeVisitor
- object Informer
- object Path extends Serializable
- object SubgraphProperties
- Attributes
- protected
- object TraverserInnerNode extends Serializable
- Annotations
- @transient()
- object Walk
- object Weight
Shadowed Implicit Value Members
- def toString(): String
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toOuterNode[GraphTraversal[N, E]] performed by method anyToNode in scalax.collection.GraphPredef.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(graphTraversal: OuterNode[GraphTraversal[N, E]]).toString()
- Definition Classes
- NodeParam → AnyRef → Any
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toStringFormat[GraphTraversal[N, E]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (GraphTraversal[N, E], B)
- Implicit
- This member is added by an implicit conversion from GraphTraversal[N, E] toArrowAssoc[GraphTraversal[N, E]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
Welcome to the Graph for Scala API reference. Some suggested navigation entry points:
Graph
mutable.Graph
and its inner nodes.GraphEdge
objectedge
packageGraphPredef
object andImplicits
object.GraphTraversal
andTraverserInnerNode
.RandomGraph
.GraphGen
.