scalax.collection.GraphTraversalImpl

Traversal

class Traversal extends GraphTraversalImpl.Traversal

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.

Definition Classes
GraphTraversalImplGraphTraversal
Linear Supertypes
GraphTraversalImpl.Traversal, AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Traversal
  2. Traversal
  3. AnyRef
  4. Any
Implicitly
  1. by anyToNode
  2. by EdgeAssoc
  3. by any2stringadd
  4. by any2stringfmt
  5. by any2ArrowAssoc
  6. by any2Ensuring
  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: (GraphTraversalImpl.EdgeT) ⇒ Boolean, nodeVisitor: (NodeT) ⇒ VisitorReturn, edgeVisitor: (GraphTraversalImpl.EdgeT) ⇒ Unit, ordering: GraphTraversalImpl.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.

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

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

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. final def _depthFirstSearch(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, maxDepth: Int = 0, nodeUpVisitor: (NodeT) ⇒ Unit = noNodeUpAction): (Option[NodeT], ArrayStack[(NodeT, Int)])

  9. final val addFilteredMethod: (NodeT, (NodeT) ⇒ Boolean, Boolean) ⇒ Iterable[NodeT]

    Attributes
    protected
  10. final val addMethod: (NodeT, GraphTraversalImpl.EdgeT, (NodeT) ⇒ Unit) ⇒ Unit

    Attributes
    protected
  11. 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.

    Definition Classes
    TraversalTraversal
  12. final def asInstanceOf[T0]: T0

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

    Synonym for breadthFirstSearch

    Synonym for breadthFirstSearch

    Definition Classes
    Traversal
    Annotations
    @inline()
  14. 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.

    Definition Classes
    TraversalTraversal
  15. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. 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.

    Definition Classes
    TraversalTraversal
  17. def depthFirstSearchWGB(root: NodeT, predicate: (NodeT) ⇒ Boolean = noNode, globalState: Array[Handle] = Array.empty[Handle]): (Option[NodeT], ArrayStack[(NodeT, Iterable[GraphTraversalImpl.EdgeT])])

    Tail-recursive white-gray-black DFS implementation for cycle detection.

    Tail-recursive white-gray-black DFS implementation for cycle detection.

    root

    start node for the search

    predicate

    node predicate marking an end condition for the search

    Attributes
    protected[scalax.collection]
  18. final def dfs(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, maxDepth: Int = 0, nodeUpVisitor: (NodeT) ⇒ Unit = noNodeUpAction): Option[NodeT]

    Synonym for depthFirstSearch

    Synonym for depthFirstSearch

    Definition Classes
    Traversal
    Annotations
    @inline()
  19. final val doEdgeFilter: Boolean

    Attributes
    protected
  20. final val doEdgeSort: Boolean

    Attributes
    protected
  21. final val doEdgeVisitor: Boolean

    Attributes
    protected
  22. final val doFilter: Boolean

    Attributes
    protected
  23. final val doNodeFilter: Boolean

    Attributes
    protected
  24. final val doNodeSort: Boolean

    Attributes
    protected
  25. final val doNodeVisitor: Boolean

    Attributes
    protected
  26. final val edgeOrdering: GraphTraversalImpl.EdgeOrdering

    Attributes
    protected
  27. final val edgesMethod: (NodeT) ⇒ Set[GraphTraversalImpl.EdgeT]

    Attributes
    protected
  28. 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 any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  29. def ensuring(cond: (Traversal) ⇒ Boolean): Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to Ensuring[Traversal] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  30. 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 any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  31. def ensuring(cond: Boolean): Traversal

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

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

    Definition Classes
    AnyRef → Any
  34. def filteredDi(direction: Direction, node: NodeT, isVisited: (NodeT) ⇒ Boolean, reverse: Boolean): Iterable[NodeT]

    Attributes
    protected[scalax.collection]
  35. final 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]
    Definition Classes
    TraversalTraversal
    Annotations
    @inline()
  36. final 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]
    Definition Classes
    TraversalTraversal
    Annotations
    @inline()
  37. final 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]
    Definition Classes
    TraversalTraversal
    Annotations
    @inline()
  38. def finalize(): Unit

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

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

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

    Definition Classes
    AnyRef → Any
  42. 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
  43. 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
  44. 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
  45. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  46. 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
  47. 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
  48. 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
  49. final def ne(arg0: AnyRef): Boolean

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

    Definition Classes
    Traversal
  51. final val nodeOrdering: GraphTraversalImpl.NodeOrdering

    Attributes
    protected
  52. final val notVisited: (NodeT) ⇒ Boolean

    Definition Classes
    Traversal
  53. final def notify(): Unit

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

    Definition Classes
    AnyRef
  55. final val reverseEdgeOrdering: Ordering[GraphTraversalImpl.EdgeT]

    Attributes
    protected
  56. final val reverseNodeOrdering: Ordering[NodeT]

    Attributes
    protected
  57. 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
  58. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  59. def toString(): String

    Definition Classes
    AnyRef → Any
  60. 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
  61. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. 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()
  65. 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()
  66. def [B](y: B): (Traversal, B)

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

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from Traversal to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (traversal: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from Traversal to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (traversal: StringFormat).self
    Definition Classes
    StringFormat
  3. 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

Deprecated Value Members

  1. def x: Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to ArrowAssoc[Traversal] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (traversal: ArrowAssoc[Traversal]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: Traversal

    Implicit information
    This member is added by an implicit conversion from Traversal to Ensuring[Traversal] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (traversal: Ensuring[Traversal]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from GraphTraversalImpl.Traversal

Inherited from AnyRef

Inherited from Any

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

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

Inherited by implicit conversion any2stringadd from Traversal to StringAdd

Inherited by implicit conversion any2stringfmt from Traversal to StringFormat

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

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

Ungrouped