Last active
August 29, 2015 14:00
-
-
Save qmaruf/1e75e03957b9297c71b9 to your computer and use it in GitHub Desktop.
neo4j, create sample db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create db | |
create(a{n:"a"}),(b{n:"b"}),(c{n:"c"}),(d{n:"d"}),(e{n:"e"}), | |
a-[:parent_of]->b, | |
a-[:parent_of]->c, | |
b-[:parent_of]->d, | |
d-[:parent_of]->e, | |
e-[:parent_of]->c, | |
d-[:parent_of]->c; | |
#do query | |
match path=p<-[:parent_of*]-common_ancestor-[:parent_of*]->h | |
return common_ancestor as most_recent_common_ancestor | |
order by length(path) | |
limit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment