赞
踩
根据[1]安装好neo4j以后
sudo neo4j start
运行下面的代码
- from py2neo import Graph,Node, Relationship
- test_graph = Graph(
- "http://localhost:7474",
- username="appleyuchi",
- password="appleyuchi"
- )
- a = Node('Person', name='Alice')
- b = Node('Person', name='Bob')
- test_graph.create(a)
- test_graph.create(b)
- r = Relationship(a, 'KNOWS', b)
- test_graph.create(r)
- print(a, b, r)
- a['age'] = 20
- b['age'] = 21
- r['time'] = '2017/08/31'
- print(a, b, r)
然后打开:
得到
Reference:
[1]neo4j安装和启动
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。