def check_some_core_hom_is_by_subspace(vs, G, H=None, require_isomorphic=True, limit=10000): """ Check if there is a retract from G to H that "contracts" a subspace of vs. See hom.hom_is_by_subspace. If not given, H is a core of G. Returns True/False. """ if not H: H = hom.find_core(G) return any((hom.hom_is_by_subspace(G, vs, h) for h in hom.extend_hom(G, H, limit=limit)))
def check_cores_are_cubelike(n): smaller_cores_canon = set() for i in range(1,n): for gen, G in hom.nonisomorphic_cubes_Z2(i): Gcanon = tuple(G.canonical_label().edges()) smaller_cores_canon.add(Gcanon) for gen, G in hom.nonisomorphic_cubes_Z2(n): H = hom.find_core(G) if H.order() == G.order(): print "G itself core, gen by", gen continue Hcanon = tuple(hom.Graph(H).canonical_label().edges()) if Hcanon in smaller_cores_canon: continue print "Not a cube-like core", H, "of", G, "gen by", gen return False return True
def check_some_squash_or_core(G): """ Check whether given n-dim cube-like graph is either core itself, or can be squashed in one direction. Returns True or False. Fails for G gen by TODO. """ if len(G.vertices()) <= 1: return True for c in G.vertices(): if sum(map(int,c)) > 0: h = hom.squash_cube(G, c) if h: log.debug("Squashable by %s", c) return True # No squash worked H = hom.find_core(G, vertex_trans=True) if H.order() == G.order(): # G itself core return True return False