Python recursive tree, linked list thingy
Enrico Franchi
riko at despammed.com
Thu Mar 8 04:12:16 EST 2012
Wanderer <wanderer at dialup4less.com> wrote:
> How
> do you handle this sort of thing in Python?
I believe that the best thing to do is a Union-Find algorithm.
Depending on the exact nature of your problem, you may also want to
check out the Hoshen-Kopelman Algorithm. Although the algorithm itself
is rather efficient, it was born in the context of percolation, that is
to say with the assumption that the "broken" (or colored) cells are much
more likely than in your context.
--
-riko
http://www.enrico-franchi.org/
http://rik0-techtemple.blogspot.com/
More information about the Python-list
mailing list