def delAloop(g, loop): n = len(g) l = [] l = [bfu.g2num(ur.loop2graph(s,n)) for s in sls.simple_loops(g,0)] l = [num for num in l if not num == loop ] print loop, ': ', l return bfu.num2CG(reduce(operator.or_, l),n)
def prune(g): numh = bfu.g2num(g) cannotprune = True for l in sls.simple_loops(gk.digonly(g),0): gg = delAloop(g,bfu.g2num(loop2graph(l,n))) if bfu.forms_loop(gg, loop): cannotprune = False prune(gg) if cannotprune: print 'one' s.add(g)
def sorted_loops(g): l = [x for x in sl.simple_loops(g,0)] s = {} for e in l: s.setdefault(len(e),[]).append(e) return s