Naive implementation of Cooper, Harvey, Kennedy algo
        See 'A Simple,Fast Dominance Algorithm'

        Compute strict domniators

def compute_dominators(nodes):
    '''
        Naive implementation of Cooper, Harvey, Kennedy algo
        See 'A Simple,Fast Dominance Algorithm'

        Compute strict domniators
    '''
    changed = True

    for n in nodes:
        n.dominators = set(nodes)

    while changed:
        changed = False

        for node in nodes:
            new_set = intersection_predecessor(node).union({node})
            if new_set != node.dominators:
                node.dominators = new_set
                changed = True

    # compute immediate dominator
    for node in nodes:
        idom_candidates = set(node.dominators)
        idom_candidates.remove(node)

        for dominator in node.dominators:
            if dominator != node:
                [idom_candidates.remove(d) for d in dominator.dominators if d in idom_candidates and d!=dominator]

        assert len(idom_candidates)<=1
        if idom_candidates:
            idom = idom_candidates.pop()
            node.immediate_dominator = idom
            idom.dominator_successors.add(node)