I am currently using embedded python binding for neo4j. I do not have any issues currently since my graph is very small (sparse and upto 100 nodes). The algorithm I am developing involves quite a lot of traversals on the graph, more specifically DFS on the graph in general as well as on different subgraphs. In the future I intend to run the algorithm on large graphs (supposedly sparse and with millions of nodes).
Having read different threads related to the performance of python/neo4j bindings here, here, I wonder whether I should already switch to some REST API client for Python (like bulbflow, py2neo, neo4jrestclient) until I am too far to change all code.
Unfortunately, I did not find any comprehensive source of information to compare different approaches.
Could anyone provide some further insight into this issue? Which criteria should I take into account when choosing one of the options?
The Neo4j Python driver is officially supported by Neo4j and connects to the database using the binary protocol. It aims to be minimal, while being idiomatic to Python.
If you are using Jupyter or Tkinter I'd suggest using the Networkx library to import your graph from Neo4j and output it using Matplotlib . But if you want interaction with the graph, you will have to go with a JS library like Vis .
More specifically, this means that Neo4j 4.0 is guaranteed to be compatible with both 4.0 Drivers and 1.7 Drivers, and the 4.0 Drivers are guaranteed to be compatible with both Neo4j 4.0 and Neo4j 3.5.
Django is an MVC web framework so you may be interested in that if yours is to be a web application.
From the point of view of py2neo (of which I am the author), I am trying to focus hard on performance by using the batch execution mechanism automatically where appropriate as well as providing strong Cypher support. I have also recently put a lot of work into providing good options for uniqueness management within indexes - specifically, the get_or_create
and add_if_none
methods.
The easiest way to run algorithms from Python is to use Gremlin (https://github.com/tinkerpop/gremlin/wiki).
With Gremlin you can bundle everything into one HTTP request to reduce round-trip overhead.
Here's how to execute Gremlin scripts from Bulbs (http://bulbflow.com):
>>> from bulbs.neo4jserver import Graph
>>> g = Graph()
>>> script = "g.v(id).out('knows').out('knows')"
>>> params = dict(id=3)
>>> g.gremlin.execute(script, params)
The Bulbs Gremlin API docs are here: http://bulbflow.com/docs/api/bulbs/gremlin/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With