c

overflowdb.traversal

TraversalRepeatExt

final class TraversalRepeatExt[A] extends AnyVal

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TraversalRepeatExt
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new TraversalRepeatExt(trav: Iterator[A])

Type Members

  1. type Traversal[A] = Iterator[A]

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  6. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  7. def repeat[B >: A](repeatTraversal: (Traversal[A]) => Traversal[B])(implicit behaviourBuilder: (Builder[B]) => Builder[B] = RepeatBehaviour.noop[B]): Traversal[B]

    Repeat the given traversal

    Repeat the given traversal

    By default it will continue repeating until there's no more results, not emit anything along the way, and use depth first search.

    The @param behaviourBuilder allows you to configure end conditions (until|whilst|maxDepth), whether it should emit elements it passes by, and which search algorithm to use (depth-first or breadth-first).

    Search algorithm: Depth First Search (DFS) vs Breadth First Search (BFS): DFS means the repeat step will go deep before wide. BFS does the opposite: wide before deep. For example, given the graph

    L3 <- L2 <- L1 <- Center -> R1 -> R2 -> R3 -> R4

    DFS will iterate the nodes in the order:

    Center, L1, L2, L3, R1, R2, R3, R4

    BFS will iterate the nodes in the order:

    Center, L1, R1, R1, R2, L3, R3, R4
    Example:
    1. .repeat(_.out)                            // repeat until there's no more elements, emit nothing, use DFS
      .repeat(_.out)(_.maxDepth(3))                            // perform exactly three repeat iterations
      .repeat(_.out)(_.until(_.property(Name).endsWith("2")))  // repeat until the 'Name' property ends with '2'
      .repeat(_.out)(_.emit)                                   // emit everything along the way
      .repeat(_.out)(_.emit.breadthFirstSearch)                // emit everything, use BFS
      .repeat(_.out)(_.emit(_.property(Name).startsWith("L"))) // emit if the 'Name' property starts with 'L'
    Note

    this works for domain-specific steps as well as generic graph steps - for details please take a look at the examples in RepeatTraversalTests: both .followedBy and .out work.

    See also

    RepeatTraversalTests for more detail and examples for all of the above.

  8. def toString(): String
    Definition Classes
    Any
  9. val trav: Iterator[A]

Inherited from AnyVal

Inherited from Any

Ungrouped