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 edge
Predefined edges.
Predefined edges.
While basic edge types are defined in the object
GraphEdge
, the predefined edges in this package cover the following categories (prefixes, shortcuts):weighted (
W, %
), key-weighted (Wk, %#
), labeled (L, +
), key-labeled (Lk, +#
), weighted and labeled (WL, %+
), key-weighted and labeled (WkL, %#+
), weighted and key-labeled (WLk, %+#
) and key-weighted and key-labeled (WkLk, %#+#
).These predefined edges provide alternatives for any edge extension taking the burden from the user to implement his/her custom edge class - but baring the disadvantage that user edge attributes must be part of a label class as opposed to being part of the edge class directly. It may also serve as a source for looking up how to implement custom edge classes.
- 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 immutable
- package mutable
Type Members
- type AnySet[A] = Set[A]
- Attributes
- protected[scalax]
- implicit final class ChainingOps[A] extends AnyVal
Adds chaining methods
tap
andpipe
toAny
.Adds chaining methods
tap
andpipe
toAny
. Back ported from Scala 2.13. - 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 Graph[N, E[+X] <: EdgeLikeIn[X]] extends AnySet[Param[N, E]] with GraphLike[N, E, Graph]
The main trait for immutable graphs bundling the functionality of traits concerned with specific aspects.
The main trait for immutable graphs bundling the functionality of traits concerned with specific aspects.
- N
the type of the nodes (vertices) in this graph.
- E
the kind of the edges in this graph.
- trait GraphBase[N, E[+X] <: EdgeLikeIn[X]] extends 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[+X] <: EdgeLikeIn[X]] extends AnyRef
A trait for graph degree calculations.
A trait for graph degree calculations.
- N
the user type of the nodes (vertices) in this graph.
- E
the kind of the edges (links) in this graph.
- trait GraphLike[N, E[+X] <: EdgeLikeIn[X], +This[NN, EE[+XX] <: EdgeLikeIn[XX]] <: GraphLike[NN, EE[XX], This] with AnySet[Param[NN, EE[XX]]] with Graph[NN, EE[XX]]] extends GraphAsSet[N, E, [NN, EE[+XX]]This[NN, EE]] with GraphTraversal[N, E] with GraphBase[N, E] with GraphDegree[N, E]
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 higher kinded type of the edges (links) in this graph.
- This
the higher kinded type of the graph itself.
- trait GraphTraversal[N, E[+X] <: EdgeLikeIn[X]] extends GraphBase[N, E]
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[+X] <: EdgeLikeIn[X]] 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.
- type IterableOnce[A] = scala.collection.IterableOnce[A]
- Attributes
- protected[scalax]
- type MSet[A] = Set[A]
- Attributes
- protected[scalax]
- trait State[N, E[+X] <: EdgeLikeIn[X]] 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 TraverserImpl[N, E[+X] <: EdgeLikeIn[X]] extends AnyRef
Default implementation of the graph algorithms defined in GraphTraversal.
Value Members
- val AnyDegree: (Int) => Boolean
The default filter function for degrees to be included in degree calculation always returning true.
- final def MSet: Set
- Attributes
- protected[scalax]
- Annotations
- @inline()
- final def mkIterable[A](it: => Iterator[A]): Iterable[A]
- Attributes
- protected[scalax]
- Annotations
- @inline()
- object Compat
- object Graph extends GraphCoreCompanion[Graph] with Serializable
The main companion object for immutable graphs.
- object GraphBase extends Serializable
- object GraphEdge
Container for basic edge types to be used in the context of
Graph
.Container for basic edge types to be used in the context of
Graph
. You will usually simply import all its members along with the members of Param:import scalax.collection.GraphPredef._, scalax.collection.GraphEdge,_
- object GraphPredef
This object serves as a container for several
Graph
-related definitions like parameter-types and implicit conversions.This object serves as a container for several
Graph
-related definitions like parameter-types and implicit conversions.You will usually simply import all its members along with the members of
InnerEdgeParam
:import scalax.collection.GraphPredef._, scalax.collection.InnerEdgeParam._
- object GraphTraversal extends Serializable
Contains traversal parameter definitions such as direction constants.
- object State
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
.