neo4j - match a branching path of variable length -


i have graph looks this:

enter image description here

here link graph in neo4j console: http://console.neo4j.org/?id=av3001

basically, have 2 branching paths, of variable length. want match 2 paths between orange node , yellow nodes. want return 1 row of data each path, including traversed nodes. want able include different clauses on different intermediate nodes.

at end, need have table of data, this:

  • a - b - c - d
  • neo - morpheus - null - leo
  • neo - morpheus - trinity - cypher

how that? have tried using optional match, can't 2 rows separately.

i have tried using variable length path, returns 2 paths doesn't allow me access , filter intermediate nodes. plus returns list, , not table of data.

i've seen question: cypher - matching 2 different possible paths , return both

it's on same subject example complex, more generic solution simpler problem i'm looking for.

you can define end node using where statement. in case end node has no outgoing relationship. not sure why expect null on return said neo - morpheus - null - leo

match p=(n:person{name:"neo"})-[*]->(end) not (end)-->() return extract(x in nodes(p) | x.name) 

edit:

may not the best option not sure how programmatically. if use unwind 1 row. dummy solution

match p=(n{name:"neo"})-[*]->(end) not (end)-->()  nodes(p) list  return list[0].name,list[1].name,list[2].name,list[3].name 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -