Hi,
I set up the graph as in the picture, and named the collections 'node' and
'edge'.
Here's my query that returns the result sorted by direct number of children
of nodes connected to `node/1`:
FOR node IN 1..1 OUTBOUND 'node/1' edge
LET connections = LENGTH(FOR c IN edge FILTER c._from == node._id RETURN
c)
SORT connections DESC
RETURN { _id: node._id, connections }
This produces:
[
{
"_id" : "node/11",
"connections" : 8
},
{
"_id" : "node/21",
"connections" : 6
},
{
"_id" : "node/2",
"connections" : 4
},
{
"_id" : "node/7",
"connections" : 3
}
]
Is that what you're after?
Best regards
J
Am Freitag, 10. Februar 2017 04:50:25 UTC+1 schrieb Feng Wang:
>
>
>
>
>
>
>
> <https://lh3.googleusercontent.com/-QPNk6tcpTlA/WJ00YTapMUI/AAAAAAAACkM/4f2PLpZR8aU77K31fD3rwt6uVyN2TyDAwCLcB/s1600/graph.png>
>
> *Figure 1*
>
> As shown in Fig.1, I want to achieve the function like this: starting
> at the vertex 'node/1' and return the results sorted by the degree of (
> 'node/21' ,'node/11','node/2','node/7')
>
> for example in Fig.1, there are 6 nodes connected with 'node/21' ( does
> not include 'node/1') , 8 nodes connected with 'node/11' , 4 nodes
> connected with 'node/2', 3 nodes connected with 'node/7'
>
> with AQL I want to return vertex results like : [ 'node/11'
> ,'node/21','node/2','node/7' ] or vertex info ......
>
>
> btw, I try to used Subqueries , LENGTH() and sort but it did not works...
>
>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.