summaryrefslogtreecommitdiff
path: root/islands.py
blob: 4b0c7c53f413aa5d251948c97f7551467bad685c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)