-
-
Save oirodolfo/8b91cafeef65e9a438d5bdec121fdd0e to your computer and use it in GitHub Desktop.
null created by anonymous - https://repl.it/I0lO/0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import defaultdict | |
| D=defaultdict(list) | |
| def addedge(a,b): | |
| D[a].append(b) | |
| D[b].append(a) | |
| addedge(1,2) | |
| addedge(2,3) | |
| addedge(3,4) | |
| addedge(1,4) | |
| addedge(5,6) | |
| addedge(6,7) | |
| V=D.keys() | |
| #k=2 | |
| def F(X,Y): | |
| #if len(X)==k: | |
| #return | |
| if X: | |
| T = set(a | |
| for x in X | |
| for a in D[x] | |
| if a not in Y | |
| and a not in X) | |
| else: | |
| T = V | |
| Y1=set(Y) | |
| for v in T: | |
| X.add(v) | |
| print X | |
| F(X,Y1) | |
| X.remove(v) | |
| Y1.add(v) | |
| print 'original method' | |
| F(set(),set()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment