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.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Traversal
  2. AnyRef
  3. 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: (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.

    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 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.

  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 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.

  3. abstract 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.

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

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

    Definition Classes
    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, onPopFound: (NodeT) ⇒ Unit = noAction): Option[NodeT]

    Synonym for depthFirstSearch

    Synonym for depthFirstSearch

    Annotations
    @inline()
  10. final def eq(arg0: AnyRef): Boolean

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

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

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

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

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

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

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

  18. final val notVisited: (NodeT) ⇒ Boolean

  19. final def notify(): Unit

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

    Definition Classes
    AnyRef
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any

Ungrouped