Packages

p

scalax.collection

constrained

package constrained

Traits enabling to implement constraints and use constrained graphs.

Graphs may be constrained dynamically or statically.

Dynamically constrained means that a constraint is bound to a constrained Graph instance at initialization time. The constrained Graph will then delegate all calls to the methods of ConstraintMethods and ConstraintHandlerMethods to the corresponding methods of the constraint bound to it. The immutable and mutable factories Graph in this package yield dynamically constrained graphs.

To make use of dynamically constrained graphs you may make use of the predefined constraints or provide an own implementation of Constraint along with its companion object. To initialize a graph with one or several combined constraints just call the graph factory methods of the constraint package passing.

Statically constrained means that the graph class directly implements the methods declared in ConstraintMethods.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. constrained
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait BinaryOp extends Op
  2. abstract class CompanionAlias[E[X] <: EdgeLikeIn[X]] extends GraphConstrainedCompanionAlias[Graph, E]

    Enables to quickly assemble immutable constrained graph companion modules.

    Enables to quickly assemble immutable constrained graph companion modules. Example:

    import scalax.collection.constrained.CompanionAlias
    import scalax.collection.constrained.constraints.Acyclic
    
    object DAG extends CompanionAlias[DiEdge](Acyclic withStringPrefix "DAG")
  3. type Config = ConstrainedConfig

    Aims defining a constraint valid for Graph instances in the scope:

    Aims defining a constraint valid for Graph instances in the scope:

    implicit val config: Config = Acyclic
    val g = Graph(0 ~> 3) // g is constrained to Acyclic
  4. trait Constrained[N, E[X] <: EdgeLikeIn[X], +G <: Graph[N, E]] extends ConstraintMethods[N, E, G]

    Template to be mixed in by any constrained graph class.

    Template to be mixed in by any constrained graph class.

    The user of the dynamically constrained class scalax.collection.constrained.Graph or its mutable counterpart need not to be concerned about this trait because it has been mixed in there. She only needs to pass the companion object for her Constraint implementation.

    Implementors of statically constrained graph classes have to mix in this trait in their constrained graph implementations.

    See also

    ConstraintMethods

  5. abstract class Constraint[N, E[X] <: EdgeLikeIn[X], G <: Graph[N, E]] extends ConstraintMethods[N, E, G]

    Template to be implemented and passed to a dynamically constrained graph class by the user.

    Template to be implemented and passed to a dynamically constrained graph class by the user. Note that mutable state will be lost on any operation yielding a new graph. Thus it is essential to either design classes inheriting from Constraint in a pure immutable manner or taking internally care of whether the state has been lost.

    See also

    ConstraintMethods

  6. class ConstraintBinaryOp[N, E[X] <: EdgeLikeIn[X], G <: Graph[N, E]] extends ConstraintOp[N, E, G]
  7. trait ConstraintCompanion[+CC[N, E[X] <: EdgeLikeIn[X], G <: Graph[N, E]] <: Constraint[N, E[X], G]] extends AnyRef

    Base trait for ordinary Constraint companion objects.

  8. class ConstraintCompanionBinaryOp[CC[N, E[X] <: EdgeLikeIn[X], G <: Graph[N, E]] <: Constraint[N, E[X], G]] extends ConstraintCompanionOp

    Facilitates binary operations on ConstraintCompanions.

  9. abstract class ConstraintCompanionOp extends ConstraintCompanion[Constraint]

    Base class for any operation on ConstraintCompanions.

  10. trait ConstraintMethods[N, E[X] <: EdgeLikeIn[X], +G <: Graph[N, E]] extends AnyRef

    This template contains all methods that constrained graphs call to decide whether operations altering a mutable graph or operations yielding a new graph from an immutable or mutable graph are valid.

    This template contains all methods that constrained graphs call to decide whether operations altering a mutable graph or operations yielding a new graph from an immutable or mutable graph are valid.

    Constraint methods are called on graph creation and node/edge addition and subtraction at two points of time, respectively: prior to the operation and after the operation has taken place but still may be rolled back. Thus, constraint method names are prefixed by pre or post. Pre-ckecks return Abort, PostCheck or Complete while post-checks return Boolean stating whether the operation should be committed or rolled back. Pre-checks can inspect the operands only. In contrast, post-checks additionally allow to inspect the would-be graph after the operation has taken place but has not yet been committed.

    For performance reasons, implementations should prefer implementing pre-check methods. If it's necessary to check not only the operands but the whole would-be graph, the appropriate post-check methods should be overridden.

  11. abstract class ConstraintOp[N, E[X] <: EdgeLikeIn[X], G <: Graph[N, E]] extends Constraint[N, E, G]
  12. sealed trait ConstraintViolation extends AnyRef
  13. type DAG[N] = Graph[N, DiEdge]

    Default (immutable) directed acyclic Graph.

  14. type Forest[N] = Graph[N, UnDiEdge]

    Default (immutable) undirected acyclic Graph.

  15. trait Graph[N, E[X] <: EdgeLikeIn[X]] extends Set[Param[N, E]] with collection.Graph[N, E] with GraphLike[N, E, Graph]

    A trait for dynamically constrained graphs.

    A trait for dynamically constrained graphs.

    N

    the type of the nodes (vertices) in this graph.

    E

    the kind of the edges in this graph.

  16. trait GraphLike[N, E[X] <: EdgeLikeIn[X], +This[X, Y[X] <: EdgeLikeIn[X]] <: GraphLike[X, Y[X], This] with Set[Param[X, Y[X]]] with Graph[X, Y[X]]] extends collection.GraphLike[N, E, This] with GraphOps[N, E, This] with Constrained[N, E, This[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 its representation.

    If E inherits DirectedEdgeLike 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.

  17. trait GraphOps[N, E[X] <: EdgeLikeIn[X], +This[X, Y[X] <: EdgeLikeIn[X]] <: GraphLike[X, Y[X], This] with Set[Param[X, Y[X]]] with Graph[X, Y[X]]] extends AnyRef
  18. sealed trait Op extends AnyRef
  19. case class PostCheckFailure(cause: Any) extends ConstraintViolation with Product with Serializable
  20. class PreCheckResult extends ConstraintViolation

    The return type of any pre-check.

    The return type of any pre-check. followUp contains the return status (follow-up activity). Constraint implementations are encouraged to extend this class to contain further data calculated in course of the pre-check and reusable in the following post-check.

  21. trait PreCheckResultCompanion extends AnyRef
  22. type Tree[N] = Graph[N, UnDiEdge]

    Default (immutable) undirected connected acyclic Graph.

  23. trait UserConstrainedGraph[N, E[X] <: EdgeLikeIn[X], +G <: Graph[N, E]] extends AnyRef

Value Members

  1. def Config: ConstrainedConfig.type

    Companion object to configure Graph instances in the scope including ArraySet.Hints:

    Companion object to configure Graph instances in the scope including ArraySet.Hints:

    implicit val config = Config(Acyclic)(ArraySet.Hints(64, 0, 64, 75))
    val g = Graph(0 ~> 3) // g is constrained to Acyclic using the above optimization hints
  2. implicit def constraintToConfig(constraint: ConstraintCompanion[Constraint])(implicit orderHint: Int = GraphConfig.defaultOrder, adjacencyListHints: Hints = ArraySet.Hints()): ConstrainedConfig

    Converts constraint to an instance of config.ConstrainedConfig.

  3. def dagConstraint: constrained.constraints.Acyclic.PrefixedConstraintCompanion

    Constraint representing a DAG.

  4. def forestConstraint: constrained.constraints.Acyclic.PrefixedConstraintCompanion

    Constraint representing a forest.

  5. def treeConstraint: constrained.ConstraintCompanionBinaryOp.PrefixedConstraintCompanion

    Constraint representing an undirected tree.

  6. object And extends BinaryOp with Product with Serializable
  7. object DAG extends CompanionAlias[DiEdge]

    Companion module for default (immutable) directed acyclic Graph.

  8. object Forest extends CompanionAlias[UnDiEdge]

    Companion module for default (immutable) undirected acyclic Graph.

  9. object Graph extends GraphConstrainedCompanion[Graph] with Serializable

    Default factory for constrained graphs.

    Default factory for constrained graphs. Graph instances returned from this factory will be immutable.

  10. object Or extends BinaryOp with Product with Serializable
  11. object PreCheckFollowUp extends Enumeration

    Enumerates the possible return statuses (also: follow-up activity) of a pre-check: Abort instructs the caller to cancel the operation because the pre-check failed; PostCheck means that the post-check (commit) still must be called; Complete means that the operation can safely be completed without invoking the post-check.

  12. object PreCheckResult extends PreCheckResultCompanion
  13. object Tree extends CompanionAlias[UnDiEdge]

    Companion module for default (immutable) undirected connected acyclic Graph.

Inherited from AnyRef

Inherited from Any

Ungrouped