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
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Traversal
  2. Traversal
  3. AnyRef
  4. Any
  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.

    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. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  6. final val addFilteredMethod: (NodeT, (NodeT) ⇒ Boolean, Boolean) ⇒ Iterable[NodeT]

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

    Attributes
    protected
  8. 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 to start the traversal from.

    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 limits the number of layers for BFS respectively the number of consecutive child visits before siblings are visited for DFS. 0 - the default - indicates that the traversal should have an unlimited depth meaning that it will be continued either until it's canceled by nodeVisitor or until all nodes have been visited.

    returns

    the node found if any.

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

    Definition Classes
    Any
  10. 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()
  11. 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 to start the traversal from.

    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 limits the number of layers for BFS respectively the number of consecutive child visits before siblings are visited for DFS. 0 - the default - indicates that the traversal should have an unlimited depth meaning that it will be continued either until it's canceled by nodeVisitor or until all nodes have been visited.

    returns

    the node found if any.

    Definition Classes
    TraversalTraversal
  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. def depthFirstSearch(root: NodeT, pred: (NodeT) ⇒ Boolean = noNode, maxDepth: Int = 0, nodeUpVisitor: (NodeT) ⇒ Unit = noNodeUpAction, onPopFound: (NodeT) ⇒ Unit = noAction): 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 to start the traversal from.

    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 limits the number of layers for BFS respectively the number of consecutive child visits before siblings are visited for DFS. 0 - the default - indicates that the traversal should have an unlimited depth meaning that it will be continued either until it's canceled by nodeVisitor or until 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.

    onPopFound

    This function is called for all nodes from the node found by pred back to root skipping backward along the path from root to the node found.

    returns

    the node found if any.

    Definition Classes
    TraversalTraversal
  14. def depthFirstSearchWGB(root: NodeT, predicate: (NodeT) ⇒ Boolean = noNode, onPopFound: (NodeT) ⇒ Unit = noAction, globalState: Array[Handle] = Array.empty[State.Handle]): Option[NodeT]

    Tail-recursive DFS implementation for cycle detection based on the idea of the white-gray-black algorithm.

    Tail-recursive DFS implementation for cycle detection based on the idea of the white-gray-black algorithm.

    root

    start node for the search

    predicate

    node predicate marking an end condition for the search

    onPopFound

    action to be carried out for every node beginning at the node found by the search and ending with root; this parameter is primarily used to build a path after a successful search.

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

    Synonym for depthFirstSearch

    Synonym for depthFirstSearch

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

    Attributes
    protected
  17. final val doEdgeSort: Boolean

    Attributes
    protected
  18. final val doEdgeVisitor: Boolean

    Attributes
    protected
  19. final val doFilter: Boolean

    Attributes
    protected
  20. final val doNodeFilter: Boolean

    Attributes
    protected
  21. final val doNodeSort: Boolean

    Attributes
    protected
  22. final val doNodeVisitor: Boolean

    Attributes
    protected
  23. final val edgeOrdering: GraphTraversalImpl.EdgeOrdering

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

    Attributes
    protected
  25. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[scalax.collection]
  28. 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()
  29. 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()
  30. 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()
  31. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  32. final def getClass(): Class[_]

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

    Definition Classes
    AnyRef → Any
  34. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  35. final def ne(arg0: AnyRef): Boolean

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

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

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

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

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

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

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

    Attributes
    protected
  43. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  44. def toString(): String

    Definition Classes
    AnyRef → Any
  45. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from GraphTraversalImpl.Traversal

Inherited from AnyRef

Inherited from Any

Ungrouped