Showing results for 
Search instead for 
Did you mean: 

Neo4j return graph results from API


I am trying to return neo4j graph results for Cytoscape js to consume it in the front end. I am currently using Neo4j Python Driver 4.2 and i am unable to return graph results either by using neo4j result.values() and result.graph() method.

-values method is i am unable to be serialized by python json module
-graph method only returns graph object but i am unable to find an iterator to view the results.

Please help.



There is no trivial way to serialize a graph into JSON. How to represent a Node, how to represent a relation, etc? There are many options and none of them stands out the the one way to go. A simple thing to play around with could be:

result ="<SOME QUERY>")

This has it's limitations though. It can serialize nodes, relationships, and their attributes as long as there is an appropriate representation of them in json. For instance, this will fail if there is temporal or geospatial data in the queried subgraph.