建立Neo4j链接
!pip install neo4j pyahocorasick numpy pandas --no-warn-script-location
定义数据操作对象
from neo4j_driver import Neo4jConnection, Node
链接并查看节点数量
conn = Neo4jConnection('neo4j://localhost:7687/', 'neo4j', 'Lorne@2022')
conn.create(Node("Person", name="Alice", age=30))
conn.create(Node("Person", name="Bob", age=30))
conn.create(Node("Person", name="Charlie", age=30))
print("数据库中的节点总数:", conn.counts())
创建所有关系
edges = [('Alice', 'Bob'), ('Alice', 'Charlie')]
conn.relationship('Person', 'Person', edges, 'KNOWS', 'friend')
清空所有的数据
conn.clear()