neo4j find all nodes with matching properties

后端 未结 7 2040
走了就别回头了
走了就别回头了 2020-12-30 04:15

I have a relatively large set of nodes, and I want to find all pairs of nodes that have matching property values, but I don\'t know or care in advance what the property valu

7条回答
  •  旧巷少年郎
    2020-12-30 04:50

    You can try this one who does which I think does whatever you want.

    START n=node(*), m=node(*)
    WHERE 
      HAS(n.name) AND HAS (m.name) AND 
      n.name=m.name AND 
      ID(n) 

    http://console.neo4j.org/?id=xe6wmt

    Both nodes should have a name property. name should be equal for both nodes and we only want one pair of the two possibilites which we get via the id comparison. Not sure about performance - please test.

提交回复
热议问题