5

My aim is to find whether the max path length between two vertices is <= 4.

I have a graph dataframe and a test file of the below format.

I am trying to get the output column(OP) from bfs function of graph dataframes.

Col1, Col2, OP
a1,   a4,   true
a2,   a1,   false
a3,   a5,   true

Currently, I am looping through each and every row and applying bfs like below

gf.bfs.fromExpr("id = 'a1'").toExpr("id = 'a4'").maxPathLength(4).run()

Are there any better approaches where I can directly plugin list of vertices at source and destination to calculate the bfs in graph frames.

0 Answers0