[ad_1]

Let´s say we have a graph with *nodes (n)* and *edges [e]*. The edges all have properties, at least one of them numerical called *‘weight’*.

Now I want to know what the ‘most tightly connected’ neighboring (sibling / one-hop distance) nodes are for each respective node. As basis, I want to rank the neighboring nodes based on the weight property descending.

What would the query be for this in Neo4j? (in SQL, we could use a function like RANK())

e.g. let´s say my node has 4 neighboring nodes with weights (3,1,8,5). Then the query should return as rows a) the id of the node b) the weight of the node c) the overall rank of the node, so here in this case (3,4,1,2).

[ad_2]