package collection
Contains the base traits and objects needed to use Graph for Scala.
See also the Graph for Scala Core User Guide.
- Alphabetic
- By Inheritance
- collection
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package config
- package edges
- package generator
This package helps you to create random graphs with predefined metrics.
This package helps you to create random graphs with predefined metrics. It is not only possible to create random graph instances but also Scalacheck generators.
- package generic
- package hyperedges
- package immutable
- package mutable
Type Members
- trait AnyGraph[N, E <: Edge[N]] extends GraphLike[N, E, AnyGraph]
Bundled functionality for mutable and immutable graphs alike.
Bundled functionality for mutable and immutable graphs alike.
- N
the type of the nodes (vertices) in this graph.
- E
the type of the edges in this graph.
- type AnySet[A] = Set[A]
- Attributes
- protected[scalax]
- type ExtSet[A] = Set[A] with ExtSetMethods[A]
scala.collection.Set extended by some useful methods in the context of Graph.
- trait ForeachBasedDetachingIterable[+A] extends Iterable[A]
Substitute for Scala 2.12
Traversable
to continue support for collections that cannot implementhasNext
/next
easily.Substitute for Scala 2.12
Traversable
to continue support for collections that cannot implementhasNext
/next
easily. The methods of Scala 2.13'sIterableOnce
are implemented in terms offoreach
.All methods with a collection result detach from this
Iterable
toVector
. This makes sense whenever theforeach
implementation - causes significant computation overhead or - is not valid for arbitrary subcollections. - trait GraphBase[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphBase[X, Y, CC]] extends GraphOps[N, E, CC] with OuterElems[N, E] with Serializable
Base template trait for graphs.
Base template trait for graphs.
This trait provides the common structure and base operations for immutable graphs independently of their representation. Base operations also cover one-step traversals. For unlimited traversals see
trait GraphTraversal
.Users of Graph usually don't interact directly with this trait but with
trait Graph
instead which inherits the functionality provided by this trait.If
E
inheritsDirectedEdgeLike
the graph is directed, otherwise it is undirected or mixed.- N
the user type of the nodes (vertices) in this graph.
- E
the kind of the edges (links) in this graph.
- trait GraphDegree[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphBase[X, Y, CC]] extends AnyRef
Mixin for degree calculations.
Mixin for degree calculations.
- N
the user type of the nodes (vertices) in this graph.
- E
the type of the edges in this graph.
- trait GraphLike[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, CC] with AnyGraph[X, Y]] extends GraphBase[N, E, [X, Y]CC[X, Y]] with GraphTraversal[N, E] with GraphDegree[N, E, [X, Y]CC[X, Y]] with ToString[N, E, [X, Y]CC[X, Y]]
A template trait for graphs.
A template trait for graphs.
This trait provides the common structure and operations of immutable graphs independently of their representation.
If
E
inheritsDiHyperEdgeLike
the graph is directed, otherwise it is undirected or mixed.- N
the user type of the nodes (vertices) in this graph.
- E
the type of the edges in this graph.
- trait GraphOps[N, E <: Edge[N], +CC[X, Y <: Edge[X]]] extends OuterElems[N, E]
Operations common to mutable and immutable graphs.
- trait GraphTraversal[N, E <: Edge[N]] extends GraphBase[N, E, GraphTraversal]
Graph-related functionality such as traversals, path finding, cycle detection etc.
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.Iterable
meaning that you can process the visited nodes and edges in a functional way. - trait GraphTraversalImpl[N, E <: Edge[N]] extends GraphTraversal[N, E] with TraverserImpl[N, E] with State[N, E]
Default implementation of the functionality defined by GraphTraversal except for algorithms that are placed in TraverserImpl.
- implicit final class Iterable$Enrichments extends AnyVal
- trait LengtheningOps[+A, CC[+X] <: NonEmpty[X]] extends AnyRef
- Attributes
- protected
- type MMap[K, V] = Map[K, V]
- Attributes
- protected[scalax]
- type MSet[A] = Set[A]
- Attributes
- protected[scalax]
- sealed trait NonEmpty[+A] extends AnyRef
- trait NonEmptyFactory[CC[+X] <: NonEmpty[X]] extends AnyRef
- Attributes
- protected
- trait NonEmptyOps[+A, CC[+X] <: NonEmpty[X], SCC[+_] <: Iterable[_]] extends UnchangedSizeOps[A, CC] with LengtheningOps[A, CC] with ShorteningOps[A, CC, SCC] with ShorteningEitherOps[A, CC, SCC]
- Attributes
- protected
- final case class OneOrMore[+A](head: A, tail: Iterable[A]) extends NonEmpty[A] with NonEmptyOps[A, OneOrMore, List] with Product with Serializable
Collection of at least one element.
- sealed case class OuterEdge[N, E <: Edge[N]](edge: E) extends OuterElem[N, E] with Product with Serializable
Wraps edges to be accepted when calling
Graph(...)
. - sealed trait OuterElem[+N, +E <: Edge[N]] extends AnyRef
Represents parameters that are accepted when calling
Graph(...)
.Represents parameters that are accepted when calling
Graph(...)
.- N
the type of the nodes (vertices)
- E
the kind of the edges (links)
- trait OuterElems[N, E <: Edge[N]] extends AnyRef
Represents parameters that are accepted when calling
Graph(...)
.Represents parameters that are accepted when calling
Graph(...)
.- N
the type of the nodes (vertices)
- E
the kind of the edges (links)
- sealed case class OuterNode[+N](node: N) extends OuterElem[N, Nothing] with Product with Serializable
Wraps any type to be accepted when calling
Graph(...)
. - final case class Several[+A](head: A, _2: A, more: Iterable[A]) extends NonEmpty[A] with NonEmptyOps[A, Several, List] with Product with Serializable
Collection of at least two elements.
- trait ShorteningEitherOps[+A, CC[+X] <: NonEmpty[X], SCC[+_] <: Iterable[_]] extends AnyRef
- Attributes
- protected
- trait ShorteningOps[+A, CC[+X] <: NonEmpty[X], SCC[+_] <: Iterable[_]] extends AnyRef
- Attributes
- protected
- trait State[N, E <: Edge[N]] extends AnyRef
Adds bit fields to the graph and its nodes facilitating fast storage and retrieval of traversal-specific flags as a decoupled implementation trait.
Adds bit fields to the graph and its nodes facilitating fast storage and retrieval of traversal-specific flags as a decoupled implementation trait. These flags are often used to keep track of visited nodes. Traversals (algorithms) acquire handles by calling
withHandle
. Then, inwithHandle
's code block,node.visited
ornode.bit
is called with the supplied handle as an implicit parameter to set or get a node's flag.- Attributes
- protected
- trait ToString[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, CC] with AnyGraph[X, Y]] extends AnyRef
- Attributes
- protected
- trait TraverserImpl[N, E <: Edge[N]] extends AnyRef
Default implementation of the graph algorithms defined in GraphTraversal.
- trait UnchangedSizeOps[+A, CC[+X] <: NonEmpty[X]] extends AnyRef
- Attributes
- protected
Value Members
- val AnyDegree: (Int) => Boolean
The default filter function for degrees to be included in degree calculation always returning true.
- final def MMap: Map
- Attributes
- protected[scalax]
- Annotations
- @inline()
- final def MSet: Set
- Attributes
- protected[scalax]
- Annotations
- @inline()
- def NeverUsed: Nothing
- Attributes
- protected
- final def mkIterable[A](it: => Iterator[A]): Iterable[A]
- Attributes
- protected[scalax]
- Annotations
- @inline()
- object GraphBase extends Serializable
- object GraphTraversal extends Serializable
Contains traversal parameter definitions such as direction constants.
- object NonEmptyBuilder
- Attributes
- protected
- object OneOrMore extends NonEmptyFactory[OneOrMore] with Serializable
- object OuterImplicits
- object Several extends NonEmptyFactory[Several] with Serializable
- object State
- object ToString
Welcome to the Graph for Scala API reference. Some suggested entry points:
AnyGraph
immutable.Graph
and its inner nodesmutable.Graph
and its inner nodes.edges
package and its subpackageshyperedges
package and its subpackages.labeled edges
packagemultilabeled edges
packagelabeled hyperedges
packagemultilabeled hyperedges
packageordered labeled hyperedges
packageordered multilabeled hyperedges
objectgeneric
package.GraphTraversal
andTraverserInnerNode
.RandomGraph
.GraphGen
.