Returning an entire hierarchy (tree) using neo4j/cypher
问题 I have a graph which has a hierarchy of categories in it (similar to product categories on a shopping site, e.g., Clothing --> Mens --> Shirts --> Short Sleeve --> ...). I have a few use cases where I need to retrieve the entire hierarchy as a tree (nested ruby and/or javascript objects in this case). The only solution I've been able to come up with is to use NODES() to retrieve each unique path and then transform it into nested objects in the client. The performance of this is obviously a