views:

3114

answers:

7

I'm writing a python application that will make heavy use of a graph data structure. Nothing horribly complex, but I'm thinking some sort of graph/graph-algorithms library would help me out. I've googled around, but I don't find anything that particularly leaps out at me.

Anyone have any good recommendations?

+2  A: 

Take a look at this page on implementing graphs in python.

You could also take a look at pygraphlib on sourceforge.

Brian R. Bondy
+8  A: 

Have you looked at python-graph? I haven't used it myself, but the project page looks promising.

zweiterlinde
+2  A: 

Graphviz

flybywire
Graphviz is for graph visualization only.
Nikhil
+1  A: 

Use the Boost Graph Library - Python Bindings.

Nice one dehmann, I went for that first (being a C++ programmer by trade and absolutely loving boost), but this scares me:BGL-Python bindings are no longer being maintained <a top of page>
cpatrick
+4  A: 

Also, you might want to take a look at NetworkX

WorldCitizeN
+15  A: 

Seriously, there are two excellent choices:

NetworkX

and

igraph

I like NetworkX, but I read good things about igraph as well. I routinely use NetworkX with graphs with 1 million nodes with no problem (it's about double the overhead of a dict of size V + E)

If you want a feature comparison, see this from the Networkx-discuss list

Feature comparison thread

Gregg Lind
In particular, what I like about Networkx.... it's mostly in python, easy to edit and understand the source code, and it feels mostly "pythonic".
Gregg Lind
I was wondering, have you used it with a* or similar algorithms?
dassouki
A: 

also have a look here at bruno preiss's explanation of graphs and a sample implementation

Bob Blanchett