> But let me clear the my problem again. I have a graph. and I want to
> find 'shortest path tree' from a root node to several nodes. as a
> example if we have a graph of 5 nodes from 1 to 5, I need to build the
> shortest path tree from node 1 to nodes 2,3,5. So my question is
> instead of keeping separate lists for each destination node's shortest
> path. How can I represent and store them in a tree structure using
> python. Then I can easily find out what are the common nodes in the
> path to each destination.

A tree is just a connected acyclic rooted graph, so however you're
representing graphs should be a perfectly natural representation for
your shortest paths tree. In effect, you just treat the shortest
paths operation as an subgraph operation which only preserves the
edges that are part of a shortest path.

Geremy Condra

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to