Do incoming relationships have index-free adjacency?

26 views
Skip to first unread message

Kevin Krumwiede

unread,
Jul 10, 2016, 3:47:10 PM7/10/16
to Neo4j
I'm new to Neo4j and playing around with a simple project before I attempt anything more ambitious.

Say I have a simple domain with Games and Players.  Starting from a Game, I may want to get all related Players.  Starting from a Player, I may want to get other Players related the same Game.  Considering these queries, and not knowing yet which one will be more common, does it make any difference whether I model the domain as (g:Game)-[:HAS_PLAYER]->(p:Player) or (p:Player)-[:JOINED]->(g:Game)?  Can incoming relationships be traversed as cheaply as outgoing ones?

Clark Richey

unread,
Jul 10, 2016, 4:10:33 PM7/10/16
to ne...@googlegroups.com
It doesn't make a difference which way you make the relationship. The search will be equally fast either way 

Sent from my iPhone

On Jul 10, 2016, at 15:47, Kevin Krumwiede <kjk...@gmail.com> wrote:

I'm new to Neo4j and playing around with a simple project before I attempt anything more ambitious.

Say I have a simple domain with Games and Players.  Starting from a Game, I may want to get all related Players.  Starting from a Player, I may want to get other Players related the same Game.  Considering these queries, and not knowing yet which one will be more common, does it make any difference whether I model the domain as (g:Game)-[:HAS_PLAYER]->(p:Player) or (p:Player)-[:JOINED]->(g:Game)?  Can incoming relationships be traversed as cheaply as outgoing ones?

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Hunger

unread,
Jul 11, 2016, 5:43:35 AM7/11/16
to ne...@googlegroups.com
Yes, what Clark said, nodes have index free adjacency for both incoming and outgoing relationships. So they are fast to traverse and even substructured per type and direction.
Reply all
Reply to author
Forward
0 new messages