I am using Neo4j 3.5.17 Enterprise with GDS 1.2.

I am specifically trying to create a query that will take the top n nodes (by PageRank) and compute the Euclidean distance to each of those nodes for every node within 2 hops (ego radius=2) of those nodes. For example, suppose I have nodes A, B, and C as the 3 nodes with the highest PageRank. So then I want to get all nodes that are 2 hopes individually from each of those nodes. So that might be a set of nodes something like

```
Node A: D, E, F
Node B: G, H
Node C: I, J, K, L
```

So I want to loop through nodes A-C, find their respective nodes in the ego graph, and set the Euclidean distance on nodes D-L based on their relationship to their parent node (A-C). So I might get some result:

```
Node D has a Euclidean distance of 100.0 from Node A
...
Node G has a Euclidean distance of 200.0 from Node B
...
etc.
```

I have managed to make this work for single nodes, such as providing node A explicitly using:

```
MATCH (r1:NodeLabel)-[*..2]-(r2:NodeLabel {nodeName: 'A'})
SET r1.distance = gds.alpha.similarity.euclideanDistance(r1.myVector, r2:myVector)
RETURN DISTINCT r1.nodeName, r1.pagerank, r2.nodeName
ORDER BY r1.distance
```

However, I would like to be able to loop this over several values of `r2:nodeName`

. To do this, I have tried the following:

```
MATCH (r1:nodeLabel) WHERE r1.pagerank > 40.
MATCH (r2:nodeLabel)-[*..2]-r1
SET r2.distance = gds.alpha.similarity.euclideanDistance(r1.myVector, r2.myVector)
RETURN DISTINCT r1.nodeName, r1.pagerank, r2.nodeName
ORDER BY r2.distance
```

however I get the following error:

```
Invalid input '(': expected whitespace, comment, '.', node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', '~', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, FROM GRAPH, CONSTRUCT, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE UNIQUE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, CALL, RETURN, UNION, ';' or end of input (line 2, column 7 (offset: 56))
"MATCH (r2:nodeLabel)-[*..2]-r1"
```

Any suggestions? Thanks in advance!