How to delete all nodes that do not have any relationships - neo4j/cypher

痞子三分冷 提交于 2020-01-01 06:56:45

问题


I am generating nodes in a neo4j database and want to remove those that have no relationships. What is the best cypher instruction to do this?


回答1:


Try

MATCH (n)
WHERE size((n)--())=0
DELETE (n)


来源:https://stackoverflow.com/questions/33559454/how-to-delete-all-nodes-that-do-not-have-any-relationships-neo4j-cypher

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!