More user feedback on Sets.py

David Eppstein eppstein at ics.uci.edu
Mon Nov 10 20:29:25 CET 2003


I had a natural example of sets of sets of sets of sets today... I 
wanted to explore the trees having n labeled items at their leaves
<http://www.research.att.com/projects/OEIS?Anum=A000311>.

Each edge of such a tree forms a bipartition of the set of leaves, so I 
represented the tree as the set of its bipartitions.  Each bipartition 
is itself a set {S, U-S} where U is the set of all leaves and S is some 
subset of U.  So, each tree is represented as a set of sets of sets.  I 
ran some algorithms that involved sets of trees, so these algorithms 
constructed sets of sets of sets of sets...

This was all relatively easy using sets.py (23 new lines added to the 
code I was already using for exploring other combinatorial objects) and 
would have been much more cumbersome if I had to represent sets 
explicitly as bit vectors or dictionaries.

So, thanks for sets, and thanks for making it work under python 2.2!

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list