Advantage/Disadvantage of In and out edge vs one edge

I realize that the answer to this questions might be "it depends", but if I have a bunch of vertices labeled A and B and they always have an edge between them, is there any advantage either generically or in AWS Neptune to having an edge that is directed from A -> B and a different edge directed B -> A. Or is it just as good to have a single undirected edge (by whihic I mean use the both() step on the edge to ignore direction), and construct the traversal appropriately? In this particular case, I will have relatively few As very many Bs
3 Replies
kelvinl2816
kelvinl28162y ago
This answer is likely to be database dependent. In the specific case of Neptune, traversing an outgoing edge is more performant than traversing an incoming edge in cases where you are unable to provide the edge label. So...
out()
out()
is likely to perform better than
in()
in()
but these should be comparable
out('friend')
in('friend')
both('friend')
out('friend')
in('friend')
both('friend')
Jim Idle
Jim IdleOP2y ago
Thank you, that is useful to know. This DB is fine to bind to Neptune only. I will stick with a single edge as I can always specify the label for the edge. I guess the real answer is to test it of course.
kelvinl2816
kelvinl28162y ago
Yes - for sure - and it's quite normal to find you want to iterate on your data model based on the type of queries you need to run and how well they are performing.
Want results from more Discord servers?
Add your server