Re: list of unique non-subset sets

2005-03-19 Thread Dirk Thierbach
Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] ] >>> OK, so I need to be more precise. >>> Given a list of sets, output the largest list of sets (from this list, >>> order does not matter) such that: >>> 1) there is no set that is a PROPER subset of another set in this list >>> 2

Re: list of unique non-subset sets

2005-03-18 Thread Bengt Richter
On 18 Mar 2005 19:41:55 -0800, [EMAIL PROTECTED] wrote: >Once again my specs were incomplete. >By largest I mean exactly what you pointed out as in sum(map(len, >setlist)). > But that will not necessarily yield a single setlist taken from the source set list, so you still need a selection amongst

Re: list of unique non-subset sets

2005-03-18 Thread les_ander
Once again my specs were incomplete. By largest I mean exactly what you pointed out as in sum(map(len, setlist)). I think this might work--sorting of the initial list should do the trick. 1) sort the sets by size (in decending order) 2) put the first (largest) into a new list (Lu) for s in Lnew[1:

Re: list of unique non-subset sets

2005-03-18 Thread Raymond Hettinger
[EMAIL PROTECTED] ] > >OK, so I need to be more precise. > >Given a list of sets, output the largest list of sets (from this list, > >order does not matter) such that: > >1) there is no set that is a PROPER subset of another set in this list > >2) no two sets have exactly the same members (100% ove

Re: list of unique non-subset sets

2005-03-18 Thread Bengt Richter
On 18 Mar 2005 15:46:44 -0800, [EMAIL PROTECTED] wrote: >OK, so I need to be more precise. >Given a list of sets, output the largest list of sets (from this list, >order does not matter) such that: >1) there is no set that is a PROPER subset of another set in this list >2) no two sets have exactly

Re: list of unique non-subset sets

2005-03-18 Thread les_ander
OK, so I need to be more precise. Given a list of sets, output the largest list of sets (from this list, order does not matter) such that: 1) there is no set that is a PROPER subset of another set in this list 2) no two sets have exactly the same members (100% overlap) Seems like this problem is m

Re: list of unique non-subset sets

2005-03-18 Thread Bengt Richter
On Thu, 17 Mar 2005 23:56:46 GMT, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > >"Kent Johnson" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Raymond Hettinger wrote: >> > [EMAIL PROTECTED] >> > >> >>I have many set objects some of which can contain same group of object >> >>w

Re: list of unique non-subset sets

2005-03-18 Thread bearophileHUGS
Looking at all the hyperedges in the connected component is a big waste... You can look at just the hyperedges that share one or more nodes. (Nodes are the original letters contained in the sets, and they must be hashable). If nodes aren't integers in [0, len(l)) then you can use this simpler code

Re: list of unique non-subset sets

2005-03-17 Thread bearophileHUGS
s1 = set(['a','b','c']) s2 = set(['a','c']) s3 = set(['a','d','e','f']) s4 = set(['r','k','l']) s5 = set(['r','k','l']) ls = [s1,s2,s3,s4,s5] result1 = [s1, s3, s5] A result can contain s4 or s5 at random. This problem looks like the one of searching the correct hyperedges for a hypergraph. s1-5 a

Re: list of unique non-subset sets

2005-03-17 Thread Raymond Hettinger
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Raymond Hettinger wrote: > > [EMAIL PROTECTED] > > > >>I have many set objects some of which can contain same group of object > >>while others can be subset of the other. Given a list of sets, > >>I need to get a list of

Re: list of unique non-subset sets

2005-03-17 Thread Peter Otten
Steven Bethard wrote: > Can you just do: > > py> def uniq(lst): > ... result = [] > ... for s1 in sorted(lst, reverse=True): > ... for s2 in result: > ... if s1 <= s2: > ... break > ... else: > ... result.append(s1) > ... return 

Re: list of unique non-subset sets

2005-03-17 Thread Steven Bethard
Kent Johnson wrote: Raymond Hettinger wrote: [EMAIL PROTECTED] I have many set objects some of which can contain same group of object while others can be subset of the other. Given a list of sets, I need to get a list of unique sets such that non of the set is an subset of another or contain exactl

Re: list of unique non-subset sets

2005-03-17 Thread Kent Johnson
Raymond Hettinger wrote: [EMAIL PROTECTED] I have many set objects some of which can contain same group of object while others can be subset of the other. Given a list of sets, I need to get a list of unique sets such that non of the set is an subset of another or contain exactly the same members.

Re: list of unique non-subset sets

2005-03-17 Thread Raymond Hettinger
[EMAIL PROTECTED] > I have many set objects some of which can contain same group of object > while others can be subset of the other. Given a list of sets, > I need to get a list of unique sets such that non of the set is an > subset of another or contain exactly the same members. > > Tried to do t

Re: list of unique non-subset sets

2005-03-17 Thread Steven Bethard
[EMAIL PROTECTED] wrote: Hi, I have many set objects some of which can contain same group of object while others can be subset of the other. Given a list of sets, I need to get a list of unique sets such that non of the set is an subset of another or contain exactly the same members. Tried to do th

list of unique non-subset sets

2005-03-17 Thread les_ander
Hi, I have many set objects some of which can contain same group of object while others can be subset of the other. Given a list of sets, I need to get a list of unique sets such that non of the set is an subset of another or contain exactly the same members. Tried to do the following: s1=set(['a'