原文链接: neo4j 查询
上一篇: Python3 爬取豆瓣电影信息
下一篇: Windows 使用ssh 远程下载 上传 服务器上的文件和目录
查找由一条边相连接的两个点,即距离
match (n)-[*..1]-(m)
return n.id,m.id
集合函数,查询每个点的周围节点个数
match (n)--(m)
return n.id,count(m.id)
order by n.id
匹配模式
Patterns |
---|
(n:Person) Node with |
(n:Person:Swedish) Node with both |
(n:Person {name: {value}}) Node with the declared properties. |
(n)-->(m) Relationship from |
(n)--(m) Relationship in any direction between |
(n:Person)-->(m) Node |
(m)<-[:KNOWS]-(n) Relationship of type |
(n)-[:KNOWS|:LOVES]->(m) Relationship of type |
(n)-[r]->(m) Bind the relationship to variable |
(n)-[*1..5]->(m) Variable length path of between 1 and 5 relationships from |
(n)-[*]->(m) Variable length path of any number of relationships from |
(n)-[:KNOWS]->(m {property: {value}}) A relationship of type |
shortestPath((n1:Person)-[*..6]-(n2:Person)) Find a single shortest path. |
allShortestPaths((n1:Person)-[*..6]->(n2:Person)) Find all shortest paths. |
size((n)-->()-->()) Count the paths matching the pattern. |