我一直很好奇的东西. (假设你可以神奇地翻转neo4j中的关系方向) 哪个会更快? START a=node(345)MATCH (a)-[:foo]-(b)-[:bar]-(c)RETURN c 要么 START a=node(345)MATCH (a)-[:foo]-(b)-[:bar]-(c)RETURN c 或者无关紧要
(假设你可以神奇地翻转neo4j中的关系方向)
哪个会更快?
START a=node(345) MATCH (a)<-[:foo]-(b)<-[:bar]-(c) RETURN c
要么
START a=node(345) MATCH (a)-[:foo]->(b)-[:bar]->(c) RETURN c
或者无关紧要,在引擎盖下,你可以向任何一个方向移动?
在javadocs中找到答案( http://api.neo4j.org/current/org/neo4j/graphdb/Relationship.html)Even though all relationships have a direction they are equally well traversed in both directions so there’s no need to create duplicate relationships in the opposite direction (with regard to traversal or performance).
这回答了这一点.