def paintSCC(g, cm): nameidx = {} D = graph2dict(g) scc = ecj.scc(D) for i in range(0, len(scc)): for v in scc[i]: g.vs[g.vs['label'].index(v)]["color"] = cm[i]
def compatibleAtU(uGstar): compat = [] n = len(uGstar) numG = 2 ** (n ** 2) # pbar = Percentage() for i in range(1, numG): G = num2CG(i, n) # pbar.update(i+1) if len(ecj.scc(G)) > 1: continue l = searchMatch(uGstar, G, iter=5) if l: compat.append((l, G)) # pbar.finish() return compat
def randSCC(n): G = num2CG(scipy.random.randint(2 ** (n ** 2)), n) while (len(ecj.scc(G)) > 1) or gcd4scc(G) > 1: G = num2CG(scipy.random.randint(2 ** (n ** 2)), n) return G