Beispiel #1
0
def iteqclass(H, verbose=True, capsize=100):
    '''
    Find all graphs in the same equivalence class with respect to
    graph H and any undesampling rate.
    '''
    if cmp.isSclique(H):
        print 'not running on superclique'
        return None
    g = {n: {} for n in H}
    s = set()
    Hnum = bfu.ug2num(H)
    if Hnum[1] == 0: s.add(Hnum[0])

    cp = confpairs(H)
    ccf = conflictors(H)

    edges = gk.edgelist(gk.complement(g))
    ds = {bfu.g2num(g): edges}

    if verbose: print '%3s' % 'i' + '%10s' % ' graphs'
    for i in range(len(H)**2):
        ds, ss = add2set_(ds,
                          H,
                          cp,
                          ccf,
                          iter=i,
                          verbose=verbose,
                          capsize=capsize)
        s = s | ss
        if capsize <= len(ss): break
        if not ds: break

    return s
Beispiel #2
0
def iteqclass(H, verbose=True, capsize=100):
    '''
    Find all graphs in the same equivalence class with respect to
    graph H and any undesampling rate.
    '''
    if cmp.isSclique(H):
        print 'not running on superclique'
        return None
    g = {n:{} for n in H}
    s = set()
    Hnum = bfu.ug2num(H)
    if Hnum[1]==0: s.add(Hnum[0])

    cp = confpairs(H)
    ccf = conflictors(H)

    edges = gk.edgelist(gk.complement(g))
    ds = {bfu.g2num(g): edges}

    if verbose: print '%3s'%'i'+'%10s'%' graphs'
    for i in range(len(H)**2):
        ds, ss = add2set_(ds, H, cp, ccf, iter=i,
                            verbose=verbose,
                            capsize=capsize)
        s = s | ss
        if capsize <= len(ss): break
        if not ds: break

    return s
def checkconflict_(Hnum, G_test, au = None):
    if not au:
        allundersamples = bfu.call_undersamples(G_test)
    else:
        allundersamples = au
    #Hnum = bfu.ug2num(H)
    for graph in allundersamples:
        gnum = bfu.ug2num(graph)
        if gnum[0]&Hnum[0] == gnum[0] and gnum[1]&Hnum[1] == gnum[1]:
            return False
    return True
Beispiel #4
0
def checkconflict_(Hnum, G_test, au=None):
    if not au:
        allundersamples = bfu.call_undersamples(G_test)
    else:
        allundersamples = au
    #Hnum = bfu.ug2num(H)
    for graph in allundersamples:
        gnum = bfu.ug2num(graph)
        if gnum[0] & Hnum[0] == gnum[0] and gnum[1] & Hnum[1] == gnum[1]:
            return False
    return True