I am looking for some package that handles graphs in python or C or C++. There are quite a few out there, as found in Google. But that is why I come here...

Handling graphic representations and stats is a plus, of course.

I would likely not need to develop/implement algoithms, etc. But I would most likely need to modify code to suit my needs, in minor aspects.

Any recommendation?


  • 1
    What do you mean by "handles graphs"? And are you looking to develop something on your own, or something for end-users?
    – einpoklum
    Commented Jul 22, 2016 at 7:08
  • @einpoklum - As of now, I am not certain about the reach of my work. If a definition is demanded, I would say that I am an end-user at this point. Commented Jul 22, 2016 at 9:00
  • You have to edit your question to say that, and to give at least one concrete example of what you intend to be doing. Also, if you're an end user - why would you care about the language?
    – einpoklum
    Commented Jul 22, 2016 at 9:04
  • @einpoklum - End-user means for me that I would likely not need to develop/implement algoithms, etc. But I would most likely need to modify code to suit my needs, in minor aspects. Commented Jul 22, 2016 at 9:08

3 Answers 3


To handle graphs data structures in Python there is the popular networkx.

Another simpler and effective library is Altgraph (that I use and contribute to)

  • I have found NetworkX, and it seems to be somewhat popular. Do you have any comments, on pros and cons, maturity, etc.? Same for Altgraph. Commented Jul 28, 2016 at 9:07
  • 1
    It is full featured. Never a bad choice. I preferred altgraph for simpler hacking Commented Jul 28, 2016 at 9:08

I code both Python & C++ (and a few others), and I eschew drag & drop, GUI based, tools in favour of those which take their input from a text file. That makes it easy for me to develop programs to generate the input text file from my own data.

You may not want to do that, but it is still worthwhile looking at GraphViz.

As an example:

graph { 
    a -- b; 
    b -- c; 
    a -- c; 
    d -- c; 
    e -- c; 
    e -- a; 

enter image description here

Obviously, it can produce much more complex diagrams that that, but that shows the principle - a simple text language to describe the relationship between nodes.

Take a look at their gallery to see how powerful it is.

GraphViz has been around for a long time, is well supported, has an active forum and is widely used in academia and in some popular tools like DoxyGen.


SNAP (Stanford Network Analysis Platform) is a C++ library for the processing and analysis of graphs and networks. There is also a Python wrapper. From the SNAP website:

Stanford Network Analysis Platform (SNAP) is a general purpose, high performance system for analysis and manipulation of large networks. Graphs consists of nodes and directed/undirected/multiple edges between the graph nodes. Networks are graphs with data on nodes and/or edges of the network.

The core SNAP library is written in C++ and optimized for maximum performance and compact graph representation. It easily scales to massive networks with hundreds of millions of nodes, and billions of edges. It efficiently manipulates large graphs, calculates structural properties, generates regular and random graphs, and supports attributes on nodes and edges. Besides scalability to large graphs, an additional strength of SNAP is that nodes, edges and attributes in a graph or a network can be changed dynamically during the computation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.