Hi,
I'm working with a graph containing > 50 types of nodes, and want to i) find all nodes of type "Gene" that are connected to node named "cardiomyopathy" of type "Disease", and ii) arrange the nodes found in order of their degree centrality.
For i) I do the following:
MATCH (c:Disease {name:"cardiomyopathy"})-[]-(g:Gene)
RETURN g.name AS Gene
but I can't figure out how to arrange the Gene nodes obtained above by their degree centrality.
For example, the following doesn't work,
MATCH (c:Disease {name: "cardiomyopathy"})-[]-(g:Gene)
WITH g, size((g)--()) as degreeCentrality
RETURN g.name AS Gene, degreeCentrality
ORDER BY degreeCentrality DESC
and throws an error
A pattern expression should only be used in order to test the existence of a pattern. It should therefore only be used in contexts that evaluate to a boolean, e.g. inside the function exists() or in a WHERE-clause. No other uses are allowed, instead they should be replaced by a pattern comprehension. (line 2, column 14 (offset: 69))
"WITH g, size((g)--()) as degreeCentrality"
I'm using neo4j 5.6 within neo4j desktop. I also have the gds and apoc plugins available.
Thanks,
Tarak