How to get degree of a node while filtering using MATCH in neo4j

前端 未结 2 473
谎友^
谎友^ 2021-01-13 21:47

I have a graph with 4 levels. While filtering using MATCH, how can i get the \"degree\" of a node? I am always getting a \"degree\" of 1.

Here is my que

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-13 22:19

    More information would be helpful, but in general you can get the degree of a node by doing something like:

    MATCH (n)--(other)
    WHERE n.id = {id}
    RETURN count(other)
    

    If you want to find degrees for many nodes you can leave out the WHERE or specify a more generic query:

    MATCH (n)--(other)
    WHERE n.property = {value}
    RETURN n, count(other)
    

提交回复
热议问题