Python recursive tree, linked list thingy

Ian Kelly ian.g.kelly at gmail.com
Wed Mar 7 15:03:52 EST 2012


On Wed, Mar 7, 2012 at 12:49 PM, Wanderer <wanderer at dialup4less.com> wrote:
> I have a list of defective CCD pixels and I need to find clusters
> where a cluster is a group of adjacent defective pixels. This seems to
> me to be a classic linked list tree search.I take a pixel from the
> defective list and check if an adjacent pixel is in the list. If it is
> I add the pixel to the cluster and remove it from the defective list.
> I then check an adjacent pixel of the new pixel and so on down the
> branch until I don't find a defective pixel. The I move up to the
> previous pixel and check the next adjacent pixel  and so on until I'm
> back at the head I can't find any more defective adjacent pixels. How
> do you handle this sort of thing in Python?

A set of defective pixels would be the probable choice, since it
offers efficient membership testing.



More information about the Python-list mailing list