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 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: (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: 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 asInstanceOf[T0]: T0

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

    Synonym for breadthFirstSearch

    Synonym for breadthFirstSearch

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. 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()
  12. 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
  13. 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
  14. 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
  15. 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
  16. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. 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()
  20. final def getClass(): Class[_]

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

    Definition Classes
    AnyRef → Any
  22. 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
  23. 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
  24. 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
  25. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  26. 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
  27. 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
  28. 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
  29. final def ne(arg0: AnyRef): Boolean

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

  31. final val notVisited: (NodeT) ⇒ Boolean

  32. final def notify(): Unit

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

    Definition Classes
    AnyRef
  34. 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
  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  36. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. 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()
  42. 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()
  43. 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 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