Class

org.graphframes.lib

BFS

Related Doc: package lib

Permalink

class BFS extends Arguments with Serializable

Breadth-first search (BFS)

This method returns a DataFrame of valid shortest paths from vertices matching fromExpr to vertices matching toExpr. If multiple paths are valid and have the same length, the DataFrame will return one Row for each path. If no paths are valid, the DataFrame will be empty. Note: "Shortest" means globally shortest path. I.e., if the shortest path between two vertices matching fromExpr and toExpr is length 5 (edges) but no path is shorter than 5, then all paths returned by BFS will have length 5.

The returned DataFrame will have the following columns:

For example, suppose we have a graph g. Say the vertices DataFrame of g has columns "id" and "job", and the edges DataFrame of g has columns "src", "dst", and "relation".

// Search from vertex "Joe" to find the closet vertices with attribute job = CEO.
g.bfs(col("id") === "Joe", col("job") === "CEO").run()

If we found a path of 3 edges, each row would have columns:

from | e0 | v1 | e1 | v2 | e2 | to

In the above row, each vertex column (from, v1, v2, to) would have fields "id" and "job" (just like g.vertices). Each edge column (e0, e1, e2) would have fields "src", "dst", and "relation".

If there are ties, then each of the equal paths will be returned as a separate Row.

If one or more vertices match both the from and to conditions, then there is a 0-hop path. The returned DataFrame will have the "from" and "to" columns (as above); however, the "from" and "to" columns will be exactly the same. There will be one row for each vertex in GraphFrame.vertices matching both fromExpr and toExpr.

Parameters:

Returns:

Linear Supertypes
Serializable, Serializable, Arguments, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BFS
  2. Serializable
  3. Serializable
  4. Arguments
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def edgeFilter(value: String): BFS.this.type

    Permalink
  9. def edgeFilter(value: Column): BFS.this.type

    Permalink
  10. def ensuring(cond: (BFS) ⇒ Boolean, msg: ⇒ Any): BFS

    Permalink
    Implicit information
    This member is added by an implicit conversion from BFS to Ensuring[BFS] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: (BFS) ⇒ Boolean): BFS

    Permalink
    Implicit information
    This member is added by an implicit conversion from BFS to Ensuring[BFS] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean, msg: ⇒ Any): BFS

    Permalink
    Implicit information
    This member is added by an implicit conversion from BFS to Ensuring[BFS] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean): BFS

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

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

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

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

    Permalink
    Implicit information
    This member is added by an implicit conversion from BFS to StringFormat[BFS] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  18. def fromExpr(value: String): BFS.this.type

    Permalink
  19. def fromExpr(value: Column): BFS.this.type

    Permalink
  20. final def getClass(): Class[_]

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

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

    Permalink
    Definition Classes
    Any
  23. def maxPathLength(value: Int): BFS.this.type

    Permalink
  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. def run(): DataFrame

    Permalink
  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  29. def toExpr(value: String): BFS.this.type

    Permalink
  30. def toExpr(value: Column): BFS.this.type

    Permalink
  31. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. def [B](y: B): (BFS, B)

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

Inherited from Serializable

Inherited from Serializable

Inherited from Arguments

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from BFS to any2stringadd[BFS]

Inherited by implicit conversion StringFormat from BFS to StringFormat[BFS]

Inherited by implicit conversion Ensuring from BFS to Ensuring[BFS]

Inherited by implicit conversion ArrowAssoc from BFS to ArrowAssoc[BFS]

Ungrouped