0

Say I have a vertices V() and K() and I have potential edges:

V --isChildOf--> K

V <--isParentOf-- K

If I'm looking for children of vertex V, are their performance differences between:

V.out('isChildOf') vs V.in('isParentOf')?

Database: NeptuneDb

2 Answers2

1

@cybersam answer for Neptune is not accurate. According to this:

If the number of distinct predicates in a graph becomes large, the default Neptune access strategy can become inefficient. In Gremlin, for example, an in() step where no edge labels are given, or any step that uses in() internally such as both() or drop(), may become quite inefficient.

This can be mitigated by enabling OSGP Index Creation Using Lab Mode.

Kfir Dadosh
  • 1,411
  • 9
  • 9
  • 1
    Just adding an observation that it is a recommended best practice when using TinkerPop enabled graphs to always specify the edge labels if possible to help the query engine efficiently filter out edges that are not of interest regardless of the graph DB being used. – Kelvin Lawrence Apr 22 '20 at 14:58
0

[EDITED]

For neo4j, there is no performance difference between traversing inbound versus outbound relationships.

However, for Neptune, inbound relationships can be less efficient. As pointed out by @KafirDadosh, the Neptune Graph Data Model documentation states:

If the number of distinct predicates in a graph becomes large, the default Neptune access strategy can become inefficient. In Gremlin, for example, an in() step where no edge labels are given, or any step that uses in() internally such as both() or drop(), may become quite inefficient.

cybersam
  • 63,203
  • 6
  • 53
  • 76