Graph Problems (was Re: Is there a map or graph module?)

Lilith lilyth at umich.edu
Fri Mar 19 10:55:23 EST 2004


Josiah Carlson <jcarlson at nospam.uci.edu> wrote in message news:<c3dpmp$7r5$1 at news.service.uci.edu>...
> Lilith wrote:
> > Is there a python module somewhere (been searching today, no luck)
> > which has efficiently coded various graph-handling routines, such as
> > finding the shortest path through a graph, or the set of all paths
> > through a graph? I'm not a compsci-educated person, so coding my own
> > would be less parsimonious.
> > Thanks for any suggestions!
> 
> Thank Guido, http://www.python.org/doc/essays/graphs.html

That's not working for me. I should have mentioned I tried that, but I
get a slew of these errors:
  
    > File "guidograph.py", line 40, in find_all_paths
    > newpaths = find_all_paths(graph, node, end, path)

    > RuntimeError: maximum recursion depth exceeded

Guido's example works fine when I use his simple graph. When I plug in
my 9000-node graph, I get those problems even if the nodes are a few
steps away. I think my network is too big for that code.

I imagine there's some kind of recursion limit I can set somewhere,
but it's probably a problem in that the code can't handle larger
graphs. Not only does find_all_paths crash, but so does find_path.



More information about the Python-list mailing list