Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86064
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'algorithm': 0.04; '21,': 0.07; 'element': 0.07; 'elements.': 0.07; 'tom': 0.07; 'idea?': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'itself.': 0.14; 'element,': 0.16; 'empty,': 0.16; 'intersection': 0.16; 'levels,': 0.16; 'sure.': 0.16; 'thankfully,': 0.16; 'elements': 0.16; 'sat,': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'test.': 0.24; 'cc:2**0': 0.24; 'second': 0.26; 'pass': 0.26; 'least': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'sets': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'large.': 0.31; 'sets.': 0.31; 'this.': 0.32; 'figure': 0.32; 'url:python': 0.33; 'could': 0.34; 'common': 0.35; 'possible.': 0.35; 'anybody': 0.35; 'point.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'described': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'two': 0.37; 'follows:': 0.38; 'pm,': 0.38; 'url:mail': 0.40; 'easy': 0.60; 'between': 0.67; 'therefore': 0.72; '2015': 0.84; 'algorithm,': 0.84; 'common,': 0.84; 'subject:Sets': 0.84; 'union,': 0.84; 'joel': 0.91; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=MhjmaC2dEW9nJPa/D/G78jkUSq/BcG7zREbAd9NPdAM=; b=cnASzaR6HtqlQKyoOa3F/VsvTwumSaLeD0yzRXCxuvTXExFIf++wc7A/a+MBQ1ut/f GYxZXaZ1o1YnC/PJUxKkLLgRAOA7iJEG30FKc3z25PSgoWcxTqE2r5GD6zEDzw2s5j/F xEUGKH8hPEcFonqGLUTinFsrJ4K8v9AKfzArqi5T7ZwCzguKFLANjqYN4MjLRRY3ho4v MFyNJ6HVw3gdfgsVwnM0+RG9V6dAJZoIh/n95bMbT4nxX5hVV15XF99s3BH3vZgUUFYA z7MOkLD1NC9KE0k8/4oMUM+E45g/J7UNUkZsnsFVRMIhA69md+b5vc2VUvwsTYgII5h2 eW3w== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.43.138 with SMTP id w10mr4163983igl.19.1424549199649; Sat, 21 Feb 2015 12:06:39 -0800 (PST) |
| In-Reply-To | <Bg5Gw.1344030$No4.494335@fx19.iad> |
| References | <Bg5Gw.1344030$No4.494335@fx19.iad> |
| Date | Sat, 21 Feb 2015 15:06:39 -0500 |
| Subject | Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18981.1424549202.18130.python-list@python.org> (permalink) |
| Lines | 50 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1424549202 news.xs4all.nl 2913 [2001:888:2000:d::a6]:33584 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:86064 |
Show key headers only | View raw
On Sat, Feb 21, 2015 at 2:46 PM, TommyVee <xxxxxxxx@xxxxxx.xxx> wrote: > Start off with sets of elements as follows: > > 1. A,B,E,F > 2. G,H,L,P,Q > 3. C,D,E,F > 4. E,X,Z > 5. L,M,R > 6. O,M,Y > > Note that sets 1, 3 and 4 all have the element 'E' in common, therefore they > are "related" and form the following superset: > > A,B,C,D,E,F,X,Z > > Likewise, sets 2 and 5 have the element 'L' in common, then set 5 and 6 have > element 'M' in common, therefore they form the following superset: > > G,H,L,M,O,P,Q,R,Y > > I think you get the point. As long as sets have at least 1 common element, > they combine to form a superset. Also "links" (common elements) between > sets may go down multiple levels, as described in the second case above > (2->5->6). Cycles thankfully, are not possible. > > BTW, the number of individual sets (and resultant supersets) will be very > large. > > I don't know where to start with this. I thought about some type of > recursive algorithm, but I'm not sure. I could figure out the Python > implementation easy enough, I'm just stumped on the algorithm itself. > > Anybody have an idea? > start with reading about python sets. If you take the intersection of two sets it will return a set with common elements. If that is empty, they don't pass your test. If you take the union, you get a set with the set values in each. > Thanks, Tom > -- > https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Algorithm for Creating Supersets of Smaller Sets Based on Common Elements "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2015-02-21 14:46 -0500
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements Joel Goldstick <joel.goldstick@gmail.com> - 2015-02-21 15:06 -0500
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements Ethan Furman <ethan@stoneleaf.us> - 2015-02-21 12:11 -0800
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements Dave Angel <davea@davea.name> - 2015-02-21 15:18 -0500
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-21 22:40 +0000
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2015-02-21 19:07 -0500
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-22 15:02 +1100
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements wxjmfauth@gmail.com - 2015-02-22 00:15 -0800
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements Peter Pearson <pkpearson@nowhere.invalid> - 2015-02-22 16:49 +0000
Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements duncan smith <buzzard@invalid.invalid> - 2015-02-22 17:02 +0000
csiph-web