Hi,

>> Another possible use case is this: show me anyone connected to the user with 
>> ID = 123 and sort those contacts by users with the most outgoing 
>> relationships.
> 
> SECOND SCENARIO: 
>       $m := g:map()
>       $_g/V/outE/i...@id=123]/../..[g:op-value('+',$m,.,count(./outE))]
>       

Actually, given that you know that 123 is what you care about, a more efficient 
implementation would be:

$m := g:map()
g:id(123)/inE/outV[g:op-value('+',$m,.,count(./outE))]
g:sort($m,'value')

In other words, just work backwards from vertex 123. There is no need to loop 
through all vertices.

Take care,
Marko.

http://markorodriguez.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to