neo4j - Can I count the precedence relation if all the paths on the same set of nodes -


the path representing users' browse history.

i'm considering design structure should take.

for example,

the red path means user has browsed

[page a]-> [page b]-> [page b]-> [page c]-> [page b]-> [page a]

the blue path means user has browsed

[page c]-> [page d]-> [page a]

if want select browse path page c earlier page a ,

the answer should blue path

how design query in cypher query ,

which design suitable case?

thank you.

design 1 (each path share same nodes)

design 2 (each path should has own nodes.)

update

i tried apply query in model,

i want know if node 5231 before node 7222

but couldn't output.

match p=(x)-[*0..]->(y {code: '5231'}) not ()-->(x) return p order length(p) limit 1; 

data

model data download

creating disjoint subgraphs each path wasteful, , not make easier solve use case.

here query (that works unified graph) finds path (or 1 of them, if there tie) in c appears earliest.

match p=(x)-[*0..]->(y {id: 'c'}) not ()-->(x) return p order length(p) limit 1; 

this particular query ends paths finds @ c node, , not bother included subsequent nodes (there many branches, , not clear branch want follow).


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -