Efficient way to count reverse edge

if i assign count directive on edge and this edge is also reverse do you store count on reverse side too or just on the direct edge ?


I have a node type of Post and User, post type has an edge ‘like_by’ with count directive and reverse edge and it is connected with User. so by my understating and as you guys states that you store an efficient count on edge is count directive is passed. what I need to know is that, if I need to count the reverse edges on an edge with count directive. do that operation is also optimized or count directive only works on direct edge ?

1 Like

The count index works for both directions (BTW, the reverse index isn’t a “direction” it is an index that represents a direction).

As far as I can tell, yes. @pawan could confirm that.

Thanks for your answer! waiting for @pawan to confirm that if it is optimized or not, because that is my main concern

Yes, queries that use the reverse count index are as optimized as the forward ones as both the indexes are built at the same time and also stored in a similar manner.