Showing results for 
Search instead for 
Did you mean: 

What is the difference between using Neo4j for graph analytics and using python networkx for graph analytics?

Node Link

I have been trying to understand how using networkX is different from performing graph analytics in Neo4j. Need help in understanding this in detail.


Node Clone

My knowledge about networkX might be a bit outdated but your question is interesting ! Let's talk about this.
I'll start with the first thing that came to my mind after reading your question : well on one hand you have a db and not on the other hand. The db is designed to use hard disk to store information, I don't think networkX can do this. Whats does it mean ? You can work on bigger graphs with a db because you have more memory, but it's slow... Loading data from disk is slower than working on data in RAM which is what basic programs such as NX do. It also mean than with NX, you can only store your whole graph or load it all. With neo4j you might load in memory only what you want (with the proper indexes).

Ok now let's go forward.
What about the maths ? Well in both case you can define a graph as a set of nodes and a set of edges (the basic).
I believe in both cases you can add various data to the nodes and the edges. Hey what if you want to define new objects like links pointing to links or nodes grouping sets of nodes ? When it comes to this, it's harder to highlight the differences between the two apis because it really depends on what you want to do, but in my opinion with both of them you can build, to a certain extent, this kind of mathematical objects. Network X might have the advantage on this topic since it's more designed for research than neo.

What about the graphics ? Well both offers graphicals functionalities but I believe neo4j is a bit more handy because it allows you to interact with the view. You can clear some nodes of your view and fetch the neighbors of a node. On the other hand, NX comes with python so you may mix it with pythons graphics libraries. An open question and interesting question in my opinion is : what graphs aggregations algorithms can be run and visualized with these two tools ? (because i think aggregation is a cool way to visualize graphs)

What else ? Yes, the algorithms ! I won't talk about which one can help you to implement graphs algorithms more efficiently, if you want efficiency go for C and forget neo or NX.
But the variety ? I think that both have a lot of algorithms already implemented but I like two things with neo, first there is a lot of plugins to perform analytics with fun and cools algorithms. I like what people did there, these algos mixing graph and IA, the NLP etc, this is great.
NX comes with more classic algorithms but fundamentals in many graphs research area. I'm thinking about graphs sampling and graphs aggregations paritcularly.
Another thing I like with neo is that you can implement your own algorithms. You can do it too with NX but it's more impressive to allow such feature in a DB architecture.

So this is not a detailed comparison, but I hope it helps a bit

Thank you for the help. So in conclusion I believe if there is a need for the database then neo4j is a good option compared to networkx.

Graph Steward

I took a quick peek at networkX.

A few things that strike me:

  1. a networkX Graph lives in Python memory whereas Neo4J is a Graph that lives in a fully functional DB. This means you get DB things like persistence, ACID, CRUD, commits, indexing, the ability to manage very large amounts of data. You can dump a networkX Graph into various file formats.
  2. The networkX API is more like Gremlin. The Cypher Query language is much nicer to use (in many ways.). I like the ASCII art with Nodes and Relationships instead of talking about Vertices and Edges
  3. since networkX is a Python library, you get all the Python libraries for free some of which are very rich. Cypher is built on top of Java, so it can be extended or called via Python drivers, but it's clumsier.
  4. networkX has more options for displaying graphs than Neo4J but I'm not clear on the details... Neo4J has the Browser which is interactive and has a nice basic functionality.

The above is from a brief look. I might be wrong on the details....

Thank You for the help. I do agree with the fact about leveraging python features for neo4j.
I came across a python library which integrated neo4j data with networkx style data.