Standard graph API?

Magnus Lie Hetland mlh at
Mon Aug 23 22:53:27 CEST 2004

In article <eklxfytr.fsf at>, Paul Moore wrote:
>   If we had adaptation in Python (PEP 246) I'd suggest an
>   IGraph protocol, plus adapters for common implementation methods.

This is exactly what I was thinking about -- one could use
PyProtocols, for example.

The (as of now quite hypothetical) standard would, however, not have
to include such an interface; one could easily implement that (and
adapters) based on the standard description.

I'm thinking along the lines of an informational PEP.

>In my personal graph library, I found that one of the nastiest issues
>was writing suitably general DFS/BFS algorithms which had "hooks" at
>relevant points

Yes... I've been thinking about this -- it might be useful to allow
some form of traversal (where you could supply your own queue object,
for example, giving you bfs, dfs, dijkstra, prim, whatever) and have
the traversal take the form of an iterator (similar to the Boost graph
library). But if access to each node and its neighbors is available in
the interface, such traversals wouldn't really have to be part of the
standard API...

Magnus Lie Hetland     "Canned Bread: The greatest thing since sliced      bread!" [from a can in Spongebob Squarepants]

More information about the Python-list mailing list