12345678910111213141516 |
- from db.neo4j import get_neo4j_db
- graph = get_neo4j_db()
- node_id = 120
- result = graph.run(f"match path=(n:Basic)-[*]->(p:Basic) where id(n)={node_id} return nodes(path) as nodes,relationships(path) as relations")
- for r in result:
- nodes = r["nodes"]
- relations = r["relations"]
-
- for n in nodes:
- print(n.identity, n["name"])
- print("*" * 20)
- for r in relations:
- print(r.identity, type(r).__name__, r.start_node.identity, r.end_node.identity)
|