diff options
| author | Tim Hatch <tim@timhatch.com> | 2010-10-01 18:10:57 -0700 | 
|---|---|---|
| committer | Tim Hatch <tim@timhatch.com> | 2010-10-01 18:10:57 -0700 | 
| commit | 01de3f2a65c2ed4084446b5574a087b8a07275e3 (patch) | |
| tree | 941dfef25d1ddce98eff264150386f6e05655754 /islands.py | |
| download | wordtree-01de3f2a65c2ed4084446b5574a087b8a07275e3.tar.gz wordtree-01de3f2a65c2ed4084446b5574a087b8a07275e3.zip  | |
basic (slow) scripts
Diffstat (limited to 'islands.py')
| -rw-r--r-- | islands.py | 19 | 
1 files changed, 19 insertions, 0 deletions
diff --git a/islands.py b/islands.py new file mode 100644 index 0000000..4b0c7c5 --- /dev/null +++ b/islands.py @@ -0,0 +1,19 @@ +import sys +from finder import find_transformations + +def find_islands(graph): +    island_size = {} +    for g in graph: +        for key in island_size.keys(): +            if find_transformations(g, key, graph): +                island_size[key] += 1 +                break +        else: +            island_size[g] = 1 + +    print island_size + +if __name__ == '__main__': +    graph = __import__('graph_%d' % int(sys.argv[1])).graph +    find_islands(graph) +  | 
