0

I'm using GraphFrames motifs to find a path between 3 nodes (a, b, and c) in my graph. This works quite well, but unfortunately I need to find undirected paths.

How do I build an undirected graph or find a motif path that can navigate undirected edges?

val motifs = g.find("(a)-[e1]->(b); (b)-[e2]->(c)")

Thanks

webber
  • 1,834
  • 5
  • 24
  • 56

1 Answers1

0

GF is directed graph by nature and implementation. You can just union result fo all "arrow" combinations:

val patterns = Seq(
    "(a)-[e1]->(b); (b)-[e2]->(c)", 
    "(b)-[e1]->(a); (b)-[e2]->(c)" , 
    "(a)-[e1]->(b); (c)-[e2]->(b)", 
    "(b)-[e1]->(a); (c)-[e2]->(b)") 
patterns.map(g.find(_).select("a", "e1", "b", "e2", "c")).reduce(_ union _).show
Artem Aliev
  • 1,362
  • 7
  • 12