Something I've always been curious about.
(Assuming you could magically flip the directions of relationships in neo4j)
Which would be faster?
START a=node(345)
MATCH (a)<-[:foo]-(b)<-[:bar]-(c)
RETURN c
or
START a=node(345)
MATCH (a)-[:foo]->(b)-[:bar]->(c)
RETURN c
Or does it not matter, as under the hood, you can traverse in either direction?
Found the answer in the 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).
That answers that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With