def all_maotrees_have_kblock(g6): g = parse_graph6(g6) d = min(g.degree().viewvalues()) # or d > 3k/2 - 1 k = int(ceil(2 * ((d+1) / 3.0)) - 1) result = {} for m in all_maos(g): m_ = list(m) t = maotree(g, m_) found = False for p in t.paths(): if len(p) >= k: # print p kblock = certify_non_kblock(g, p[-(k+1):], k) if not kblock: found = True if not found: result['m'] = m result['t'] = t break if result: result['g'] = g6 result['k'] = k result['d'] = d return result
def single_mao_kb1p32(g6): g = parse_graph6(g6) d = min(g.degree().viewvalues()) # or d > 3k/2 - 1 k = int(ceil(2 * ((d+1) / 3.0)) - 1) result = mao_kblock(g, k+1, g.nodes_iter().next()) if result: result['g'] = g6 result['k'] = k result['d'] = d return result
def single_ALL_mao_kp1b(g6): g = parse_graph6(g6) d = min(g.degree().viewvalues()) # d >= k+1, take maximal k k = d-1 if k < 2: return last = None for l in all_maos(g): if not certify_non_kblock(g, l[-(k+1):], k+1): return return {'g': g6, 'd': d, 'k': k}
def single_mao_kp1b(g6): """ [Verm1] """ g = parse_graph6(g6) d = min(g.degree().viewvalues()) # d >= k+1, take maximal k k = d-1 s = g.nodes_iter().next() result = mao_kblock(g, k+1, s) if result: result['g'] = g6 result['k'] = k result['d'] = d return result
def single_kp1b(g6): """ [Verm3] """ g = parse_graph6(g6) d = min(g.degree().viewvalues()) # d >= k+1, take maximal k k = d-1 def chk(): for candidates in combinations(g.nodes_iter(),k+1): if not certify_non_kblock(g, candidates, k+1): return True return False if not chk(): return {'g':g6, 'd': d, 'k': k}
def single_mao_all_kp1b(g6): g = parse_graph6(g6) d = min(g.degree().viewvalues()) # d >= k+1, take maximal k k = d-1 s = g.nodes_iter().next() m = mao(g, s) for i in xrange(0, len(g)-(k+1)): result = certify_non_kblock(g, m[i:i+k+1], k+1) if not result: return # all are non-k+1-blocks result['g'] = g6 result['k'] = k result['d'] = d return result
def single_all_mao_kp1b(g6): """ [Verm2] """ g = parse_graph6(g6) d = min(g.degree().viewvalues()) # d >= k+1, take maximal k k = d-1 starters = [] for s in g.nodes_iter(): result = mao_kblock(g, k+1, s) # result = None if it is indeed a MAO if not result: starters.append(s) # we found one, let's skip ahead break if not starters: return {'g':g6, 'd':d, 'k':k}
def single_maos_kb1p32(g6): g = parse_graph6(g6) d = min(g.degree().viewvalues()) # d >= 3k/2 # or d > 3k/2 - 1 k = int(2 * (d / 3.0)) starters = [] for s in g.nodes_iter(): result = mao_kblock(g, k+1, s) # result = None if it is indeed a MAO if not result: starters.append(s) # we found one, let's skip ahead break if not starters: return {'g':g6, 'd':d, 'k':k}
def single_kb1p32(g6): g = parse_graph6(g6) d = min(g.degree().viewvalues()) # d >= 3k/2 # or d > 3k/2 - 1 k = int(2 * (d / 3.0)) if node_connectivity(g) >= k: return def chk(): for candidates in combinations(g.nodes_iter(),k+1): if not certify_non_kblock(g, candidates, k+1): return True return False if not chk(): return {'g':g6, 'k': k, 'd': d}
def maotree_all_kblock(g6): g = parse_graph6(g6) d = min(g.degree().viewvalues()) # or d > 3k/2 - 1 k = int(ceil(2 * ((d+1) / 3.0)) - 1) m = mao(g,0) t = maotree(g,m) result = None for p in t.paths(): if len(p) >= k: # print p result = certify_non_kblock(g, p[-(k+1):], k) if result: break if result: result['g'] = g6 result['k'] = k result['d'] = d return result