I need to sort nodes by their out-degree. In neo4j with cypher query language, I do do something like:
MATCH (P1:P)
RETURN P1,size((P1)-->()) as degree
ORDER BY degree DESC LIMIT 10
In gremlin, I know how to count the out degree for each node:
g.V().hasLabel('V')
.order().by(out('E').count(), desc)
.limit(10)
However, I don't see how to return the count as well as the node itself.
Is there any way to make query like this in gremlin?