scalax.collection.GraphTraversal

Traversal

abstract class Traversal extends AnyRef

Abstract class for functional traversals.

In addition to the traverse methods defined for nodes, this concept supports repeated traversals with constant direction, filters and visitors. Call newTraversal to create an instance and call any subsequent traversals on that instance.

Annotations
@deprecated
Deprecated

(Since version 1.8.0) use one of Traverser factory methods instead.

Linear Supertypes
Known Subclasses
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Traversal
  2. AnyRef
  3. Any
Implicitly
  1. by anyToNode
  2. by CollectionsHaveToParArray
  3. by EdgeAssoc
  4. by any2stringadd
  5. by StringFormat
  6. by Ensuring
  7. by ArrowAssoc
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Traversal(direction: Direction, nodeFilter: (NodeT) ⇒ Boolean, edgeFilter: (GraphTraversal.EdgeT) ⇒ Boolean, nodeVisitor: (NodeT) ⇒ VisitorReturn, edgeVisitor: (GraphTraversal.EdgeT) ⇒ Unit, ordering: GraphTraversal.ElemOrdering)

    direction

    Determines which connected nodes the traversal has to follow. The default value is Successors.

    nodeFilter

    Predicate to filter the nodes to be visited during traversal. The default value is anyNode, that is no filtering. A return of true signals that the traversal is to be canceled.

    edgeFilter

    Predicate to filter the edges to be visited during traversal. The default value is anyEdge meaning that no filtering takes place.

    nodeVisitor

    Function to be called on visiting a node for the first time during a traversal. It can mutate the node or carry out any other side effect. The default value is the empty function noNodeAction. Alternatively, an instance of ExtendedNodeVisitor may be passed to obtain additional state information such as the current depth. The concrete type of the last argument, the informer depends on the underlying implementation so you need to match against it. Concerning this method please match against scalax.collection.GraphTraversalImpl.DfsInformer or scalax.collection.GraphTraversalImpl.BfsInformer depending on the breadthFirst argument.

    edgeVisitor

    Function to be called on visiting an edge. It can mutate the node or carry out any other side effect. The default value is the empty function noEdgeAction.

    ordering

    If a NodeOrdering or EdgeOrdering different from noOrdering is supplied neighbor nodes will be sorted during the traversal. Thus it is guaranteed that the smaller an element's ranking the sooner it will be processed. In case of EdgeOrdering it is guaranteed that the smaller an edge's ranking the sooner its relevant end(s) will be processed.

Abstract Value Members

  1. abstract def apply(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, breadthFirst: Boolean = true, maxDepth: Int = 0): Option[NodeT]

    Traverses this graph from root for side-effects allowing

    Traverses this graph from root for side-effects allowing

    a) to filter nodes and/or edges, b) to carry out any side effect at visited nodes and/or edges and c) to cancel the traversal at any node.

    root

    The node where subsequent graph traversals start.

    pred

    The traversal stops at the first node except for root for which this predicate holds true and returns it. The default value noNode leads to a full traversal.

    breadthFirst

    If true the traversal is based on a breath first (BFS, layer-for-layer) search, otherwise on a depth first search (DFS). The default value is BFS.

    maxDepth

    A positive value limiting the number of layers for Bfs respectively the number of consecutive child visits before siblings are visited for Dfs. 0, the default value, indicates that the traversal should have an unlimited depth meaning that it will be continued until either it's canceled or all nodes have been visited.

    returns

    the node found if any.

  2. abstract def breadthFirstSearch(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, maxDepth: Int = 0): Option[NodeT]

    Starting at root, functionally traverses this graph up to maxDepth layers using the breadth first search algorithm and all filters, visitors etc.

    Starting at root, functionally traverses this graph up to maxDepth layers using the breadth first search algorithm and all filters, visitors etc. passed to the encapsulating Traversal instance.

    root

    The node where subsequent graph traversals start.

    pred

    The traversal stops at the first node except for root for which this predicate holds true and returns it. The default value noNode leads to a full traversal.

    maxDepth

    A positive value limiting the number of layers for Bfs respectively the number of consecutive child visits before siblings are visited for Dfs. 0, the default value, indicates that the traversal should have an unlimited depth meaning that it will be continued until either it's canceled or all nodes have been visited.

    returns

    the node found if any.

  3. abstract def depthFirstSearch(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, maxDepth: Int = 0, nodeUpVisitor: (NodeT) ⇒ Unit = noNodeUpAction): Option[NodeT]

    Starting at root, functionally traverses this graph up to maxDepth layers using the depth first search algorithm and all filters, visitors etc.

    Starting at root, functionally traverses this graph up to maxDepth layers using the depth first search algorithm and all filters, visitors etc. passed to the encapsulating Traversal instance.

    root

    The node where subsequent graph traversals start.

    pred

    The traversal stops at the first node except for root for which this predicate holds true and returns it. The default value noNode leads to a full traversal.

    maxDepth

    A positive value limiting the number of layers for Bfs respectively the number of consecutive child visits before siblings are visited for Dfs. 0, the default value, indicates that the traversal should have an unlimited depth meaning that it will be continued until either it's canceled or all nodes have been visited.

    nodeUpVisitor

    Function to be called on reaching an already visited node when moving up in the imaginary tree of a depth first search. Paired with nodeVisitor (the 'down-visitor'), this 'up-visitor' enables a stack-wise view of the traversed nodes. The default value is the empty function noNodeUpAction. Alternatively, an instance of ExtendedNodeVisitor may be passed to obtain additional state information such as the current depth. The concrete type of the last argument, the informer depends on the underlying implementation so you need to match against it. Concerning this method please match against scalax.collection.GraphTraversalImpl.DfsInformer.

    returns

    the node found if any.

  4. abstract def filteredDiPredecessors(node: NodeT, isVisited: (NodeT) ⇒ Boolean, reverse: Boolean): Iterable[NodeT]

    Computes the filtered direct predecessors of node.

    Computes the filtered direct predecessors of node. It also calls edgeVisitor but does not call nodeVisitor.

    node

    the node the direct predecessors are to be calculated of.

    isVisited

    function returning whether a specific node has already been visited during the current traversal.

    reverse

    whether to sort in reverse order. Only applicable when ordering is different from noOrdering.

    Attributes
    protected[scalax.collection]
  5. abstract def filteredDiSuccessors(node: NodeT, isVisited: (NodeT) ⇒ Boolean, reverse: Boolean): Iterable[NodeT]

    Computes the filtered direct successors of node.

    Computes the filtered direct successors of node. It also calls edgeVisitor but does not call nodeVisitor.

    node

    the node the direct successors are to be calculated of.

    isVisited

    function returning whether a specific node has already been visited during the current traversal.

    reverse

    whether to sort in reverse order. Only applicable when ordering is different from noOrdering.

    Attributes
    protected[scalax.collection]
  6. abstract def filteredNeighbors(node: NodeT, isVisited: (NodeT) ⇒ Boolean, reverse: Boolean): Iterable[NodeT]

    Computes the filtered neighbors of node.

    Computes the filtered neighbors of node. It also calls edgeVisitor but does not call nodeVisitor.

    node

    the node the adjacent are to be calculated of.

    isVisited

    function returning whether a specific node has already been visited during the current traversal.

    reverse

    whether to sort in reverse order. Only applicable when ordering is different from noOrdering.

    Attributes
    protected[scalax.collection]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from Traversal to any2stringadd[Traversal] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Traversal, B)

    Implicit information
    This member is added by an implicit conversion from Traversal to ArrowAssoc[Traversal] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. final def bfs(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, maxDepth: Int = 0): Option[NodeT]

    Synonym for breadthFirstSearch

    Synonym for breadthFirstSearch

    Annotations
    @inline()
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def dfs(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, maxDepth: Int = 0, nodeUpVisitor: (NodeT) ⇒ Unit = noNodeUpAction): Option[NodeT]

    Synonym for depthFirstSearch

    Synonym for depthFirstSearch

    Annotations
    @inline()
  10. def ensuring(cond: (Traversal) ⇒ Boolean, msg: ⇒ Any): Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to Ensuring[Traversal] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: (Traversal) ⇒ Boolean): Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to Ensuring[Traversal] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean, msg: ⇒ Any): Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to Ensuring[Traversal] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean): Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to Ensuring[Traversal] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from Traversal to StringFormat[Traversal] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  18. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  19. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  20. def isDefined: Boolean

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] performed by method anyToNode in scalax.collection.GraphPredef.
    Definition Classes
    Param
  21. def isEdge: Boolean

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] performed by method anyToNode in scalax.collection.GraphPredef.
    Definition Classes
    NodeParam
  22. def isIn: Boolean

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] performed by method anyToNode in scalax.collection.GraphPredef.
    Definition Classes
    InParamParam
  23. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  24. def isNode: Boolean

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] performed by method anyToNode in scalax.collection.GraphPredef.
    Definition Classes
    NodeParam
  25. def isOut: Boolean

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] performed by method anyToNode in scalax.collection.GraphPredef.
    Definition Classes
    InParamParam
  26. val n1: Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to EdgeAssoc[Traversal] performed by method EdgeAssoc in scalax.collection.GraphPredef.
    Definition Classes
    EdgeAssoc
  27. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. final val noAction: (NodeT) ⇒ Unit

  29. final val notVisited: (NodeT) ⇒ Boolean

  30. final def notify(): Unit

    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  32. def stringPrefix: String

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] performed by method anyToNode in scalax.collection.GraphPredef.
    Definition Classes
    NodeParam
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  34. def toParArray: ParArray[T]

    Implicit information
    This member is added by an implicit conversion from Traversal to CollectionsHaveToParArray[Traversal, T] performed by method CollectionsHaveToParArray in scala.collection.parallel. This conversion will take place only if an implicit value of type (Traversal) ⇒ GenTraversableOnce[T] is in scope.
    Definition Classes
    CollectionsHaveToParArray
  35. def toString(): String

    Definition Classes
    AnyRef → Any
  36. val value: Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] performed by method anyToNode in scalax.collection.GraphPredef.
    Definition Classes
    OuterNodeNodeParam
  37. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. def ~[N >: N1, N2 <: N](n2: N2): UnDiEdge[N]

    Implicit information
    This member is added by an implicit conversion from Traversal to EdgeAssoc[Traversal] performed by method EdgeAssoc in scalax.collection.GraphPredef.
    Definition Classes
    EdgeAssoc
    Annotations
    @inline()
  41. def ~>[N >: N1, N2 <: N](n2: N2): DiEdge[N]

    Implicit information
    This member is added by an implicit conversion from Traversal to EdgeAssoc[Traversal] performed by method EdgeAssoc in scalax.collection.GraphPredef.
    Definition Classes
    EdgeAssoc
    Annotations
    @inline()
  42. def [B](y: B): (Traversal, B)

    Implicit information
    This member is added by an implicit conversion from Traversal to ArrowAssoc[Traversal] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. def toString(): String

    Implicit information
    This member is added by an implicit conversion from Traversal to OuterNode[Traversal] 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:
    (traversal: OuterNode[Traversal]).toString()
    Definition Classes
    NodeParam → AnyRef → Any

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion anyToNode from Traversal to OuterNode[Traversal]

Inherited by implicit conversion CollectionsHaveToParArray from Traversal to CollectionsHaveToParArray[Traversal, T]

Inherited by implicit conversion EdgeAssoc from Traversal to EdgeAssoc[Traversal]

Inherited by implicit conversion any2stringadd from Traversal to any2stringadd[Traversal]

Inherited by implicit conversion StringFormat from Traversal to StringFormat[Traversal]

Inherited by implicit conversion Ensuring from Traversal to Ensuring[Traversal]

Inherited by implicit conversion ArrowAssoc from Traversal to ArrowAssoc[Traversal]

Ungrouped