如何在py2neo的neo4j图中获取所有连接的节点 [英] How to get all connected nodes in neo4j graph in py2neo
本文介绍了如何在py2neo的neo4j图中获取所有连接的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
py2neo 有没有办法在图中获取所有连接的节点.通过关系连接的所有节点?
Is there a way with py2neo to get all the connected nodes in a graph. All nodes that are connected by relationship?
推荐答案
你可以执行一个 Cypher 查询来返回那些:
You can execute a Cypher query that will return you those :
res = graph.cypher.execute("MATCH (n) WHERE size((n)--()) > 0 RETURN n");
for r in res:
print r
这篇关于如何在py2neo的neo4j图中获取所有连接的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文