Hello All,
I came up with the following queries which satisfy the purpose but I'm not sure about the performance. Please make any comments.
A) g.V().outE('votes_for').inV().order().by(inE('votes_for').count(), decr).dedup().limit(10)
This query plan first fetches all the vertices that have incoming 'votes_for' edges and then orders them by the count of the same, which I think will filter out a good chunk of vertices in the initial step. And if we use Vertex-Centric indices it can be optimized even more.
B) g.V().order().by(inE('votes_for').count(), decr).limit(10)
This query iterates through all the vertices which might be very slow. And, Here we are ordering all the vertices where as the in the above query we are ordering only a small chunk. Please correct me if I'm wrong.
Please kindly leave any useful comments on whether the above queries and my approaches are correct and efficient enough.