I was testing graphframes BFS toy example:
val g: GraphFrame = examples.Graphs.friends
val paths: DataFrame = g.bfs.fromExpr("name = 'Esther'").toExpr("name <> 'Esther'").run()
The result I get is:
+-------------+------------+------------+
| from| e0| to|
+-------------+------------+------------+
|[e,Esther,32]|[e,f,follow]|[f,Fanny,36]|
|[e,Esther,32]|[e,d,friend]|[d,David,29]|
+-------------+------------+------------+
That's pretty weird, since Fanny and David also have outgoing edges. And the vertices linked to them also have outgoing edges, e.g, the result dataframe should contain not only one hop paths, but all paths from the source vertex.
I myself created a toy graph:
1 2
2 3
3 4
4 5
And when I do the same kind of query:
g.bfs.fromExpr("id = 1").toExpr("id <> 1").run()
I still get only the one hop neighbors. Am I missing something? I also tested other operators that stand for "not equal" without success. A wild guess: Maybe when BFS is reaching again the source vertex (it should look at it, but not visit its neighbors), it does not match the "toExpr" expression and aborts.
Another question: GraphFrames is directed, isn't? In order to get an "undirect graph", I should add reciprocal edges, shouldn't I?