예제 #1
0
파일: search.py 프로젝트: Janno/kblocks
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
예제 #2
0
파일: search.py 프로젝트: Janno/kblocks
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