How to get all paths between two nodes?

graphql

#1

Assume we have a graph like this:

A----like---->B–born_in–>C
|                                        ↑
|–born_in–>D—nearby----|

How to write a query with Gizmo to get the two paths between A and C?


#2

Hi @Shijia

You can use the below query to get the complete relationship between all the nodes.

var path = g.M().Both();
g.V("A").FollowRecursive(path).ForEach( function(v){
  g.V(v.id).OutPredicates().ForEach( function(r){
	g.V(v.id).Out(r.id).ForEach( function(t){
		var node = {
		  source: v.id,
		  relation : r.id,
		  target: t.id
		}
		g.Emit(node)
	})	
  })
})