def METHOD_NAME(tps, associate_f):
    col = collections.defaultdict(set)
    for d in tps:
        for s in d:
            associate_node = set(associate_f(s))
            col[s].update(associate_node)
            for i in associate_node:
                col[s].update(col[i])
        if len(d) > 1:  # SCC
            scc = set()
            for s in d:
                scc.update(col[s])
                scc.update(d)
            for s in d:
                col[s] = scc
    return col