SetTools.py - Tools for working on sets

Author:Andreas Heger
Release:$Id$
Date:December 09, 2013
Tags:Python

Many of the functions in this module precede the set datatype in python.

Code

SetTools.combinations(list_of_sets)

create all combinations of a list of sets

returns a list of tuples ( set_composition, union, intersection )

SetTools.writeSets(outfile, list_of_sets, labels=None)

output a list of sets as a tab-separated file.

labels is a list of set labels.

SetTools.unionIntersectionMatrix(list_of_sets)

build union and intersection of a list of sets.

return a matrix with the upper diagonal the union and the lower diagonal the intersection.

SetTools.CompareSets(set1, set2)

returns the union and the disjoint members of two sets. The sets have to be sorted.

SetTools.MakeListComprehensionFunction(name, nsets)

Returns a function applicable to exactly <nsets> sets. The returned function has the signature F(set0, set1, ..., set<nsets>) and returns a list of all element combinations as tuples. A set may be any iterable object.

Table Of Contents

Previous topic

SVGdraw.py - generate SVG drawings

Next topic

Sockets.py - working with sockets

This Page