g.addEdge(source, target, 'common' ['degree':calculatedDegree])
source.outE('common').order{it.b.degree <=> it.a.degree}[0..199].inV()
HiIn the following query, if I want it to return the most common companies (basically order by descending on the groupcount) what would be the best way to do that using Java Gremlin Pipes.
If I add the order pipe at the end, it just takes forever. I want to get the top n results that are most commonly followed in a member's network. For some members, depending on the density of the graph, it can return thousand of companies and I just want to return the top 200 results.
pipe1.start(v).out("connectedTo").in("connectedTo").dedup().except(Arrays.asList(v)).out("connectedTo").except(neighbors).groupCount(r).next(200);
Best
PM
member.as("me").out("connectedTo").in("connectedTo").dedup().except("me").out("connectedTo").except(neighbors).groupCount().cap().orderMap(T.decr)[0..199]