Representing a Tree in Python

Benjamin Edwards benjumanji at googlemail.com
Fri May 15 01:24:49 CEST 2009


On May 13, 8:27 pm, CTO <debat... at gmail.com> wrote:
> On May 13, 8:19 am, bearophileH... at lycos.com wrote:
>
> > godshorse, you may use the "shortestPaths" method of this graph class
> > of mine:http://sourceforge.net/projects/pynetwork/
>
> > (It uses the same Dijkstra code by Eppstein).
> > (Once you have all distances from a node to the other ones, it's not
> > too much difficult to find the tree you talk about).
>
> > Also see the Minimum spanning tree:http://en.wikipedia.org/wiki/Minimum_spanning_tree
>
> > Bye,
> > bearophile
>
> Let me add a caution to what bearophile says here- a minimum spanning
> tree minimizes
> the weight of the *whole tree*, not the individual paths in that tree,
> which seems
> to be what you're going after. Those can be pretty different things.
>
> Geremy Condra

no love for floyds algorithm. so simple :D

http://en.wikipedia.org/wiki/Floyd-Warshall_algorithm



More information about the Python-list mailing list