# coding=utf-8 from py2neo import Node, Relationship #节点和关系 a = Node("Person", name="Alice") b = Node("Person", name="Bob") ab = Relationship(a, "KNOWS", b) print a print a.fromkeys('Person') print a.properties print b print ab.type print ab.start_node() print ab.end_node() thenode = set([]) def buildNodes(node): data = { "id": str(node[0].properties), "label": next(iter(node[0].labels())) } # print node[0] thenode.add(str(node[0].properties)) print "label", next(iter(node[0].labels())) return {"data": data} startnode = set([]) endnode = set([])