Closed yGuy closed 2 years ago
It should be easy to provide support for neo4j graphs. This should be documented or built right into the extension.
Loading neo4j graph data results is pretty trivial already, actually:
%pip install neo4j from neo4j import GraphDatabase uri = "bolt://uritodatabase" user = "username" # your user name # default is always "neo4j" # unless you have changed it. password = "putyoursecretpassword-here" driver = GraphDatabase.driver(uri=uri,auth=(user,password)) session = driver.session() result = session.run("MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20") g = result.graph() from yfiles_jupyter_graphs import GraphWidget w = GraphWidget() w.nodes = list(map(lambda neoNode: ({"id": neoNode.id, "properties":{**dict(neoNode.items()), "label":list(neoNode.labels)[0]}}), g.nodes)) w.edges = list(map(lambda relationship: ({"id": relationship.id, "start": relationship.start_node.id, "end": relationship.end_node.id, "properties": {**dict(relationship.items()), "label": relationship.type}}), g.relationships)) w.show()
It should be easy to provide support for neo4j graphs. This should be documented or built right into the extension.
Loading neo4j graph data results is pretty trivial already, actually: