Neo4j 知识总结

Published 2023年02月02日 15:00 by james

Root to leaf in a tree

MATCH p=(parent:Root)-[:HAS_CHILD*1..10]->(child:Node)
WHERE NOT (child)-[:HAS_CHILD]->()
RETURN p

统计根节点叶节点之间路径的最大长度

MATCH p = (root)-[*]->(leaf)
WHERE NOT ()-->(root) AND NOT (leaf)-->()
RETURN MAX(length(p))

Longest path when there are multiple paths present

MATCH p=(start:Node)-[:REL*1..10]->(end:Node)
WHERE id(start) = 123 AND id(end) = 456
RETURN p
ORDER BY length(p) DESC
LIMIT 10

0 comments

There are no comments yet.

Add a new comment

Similar posts

There are no similar posts yet.