Ejemplo n.º 1
0
def unfoldplot(G,
               steps=7,
               repeats=5,
               gap=0.5,
               R=1,
               hg=0.1,
               wgap=0.7,
               name='AAA',
               stl=''):
    u = 0
    dbnprint(undersample(G, u),
             repeats,
             w_gap=wgap,
             h_gap=hg,
             mname=name + str(u),
             type='hid',
             stl=stl)
    print "\\node[left=" + str(gap) + "cm of " + name + str(
        u) + ",scale=0.7] (C) {"
    print "\\begin{tikzpicture}"
    cdbnprint(G, mtype='hid', bend=15, curve=5, R=R)
    print "\\end{tikzpicture}"
    print "};"
    for u in range(1, steps):
        dbnprint(undersample(G,u),repeats,w_gap=wgap,h_gap=hg,mname=name+\
                     str(u),type='ahid',stl=', below=0.25cm of '+name+str(u-1))

        print "\\node[left=" + str(gap) + "cm of " + name + str(
            u) + ",scale=0.7] () {"
        print "\\begin{tikzpicture}"
        cdbnprint(undersample(G, u), mtype='lahid', bend=15, curve=5, R=R)
        print "\\end{tikzpicture}"
        print "};"
    emacs_vars()
Ejemplo n.º 2
0
def simple_loops(g, u):
    """
    iterator over the list of simple loops of graph g at the undersample rate u
    """
    gx = graph2nx(num2CG(g2num(undersample(g,u)), len(g)))
    for l in networkx.simple_cycles(gx):
        yield l
Ejemplo n.º 3
0
def simple_loops(g, u):
    """
    iterator over the list of simple loops of graph g at the undersample rate u
    """
    gx = graph2nx(num2CG(g2num(undersample(g, u)), len(g)))
    for l in networkx.simple_cycles(gx):
        yield l
Ejemplo n.º 4
0
def SM_converging(Gstar, G):
    """Gstar is the undersampled reference graph, while G is the starting
    graph. The  code searches  over all undersampled  version of  G to
    find all matches with Gstar
    """
    compat = []
    GG = G
    Gprev = G
    if G == Gstar: return [0]
    j = 1
    G = ecj.undersample(GG, j)
    while not (G == Gprev):
        if Gstar == G: compat.append(j)
        j += 1
        Gprev = G
        G = ecj.undersample(GG, j)
    return compat
Ejemplo n.º 5
0
def SM_converging(Gstar,G):
    """Gstar is the undersampled reference graph, while G is the starting
    graph. The  code searches  over all undersampled  version of  G to
    find all matches with Gstar
    """
    compat = []
    GG = G
    Gprev = G
    if G == Gstar: return [0]
    j = 1
    G = ecj.undersample(GG,j)
    while not (G == Gprev):
        if Gstar == G: compat.append(j)
        j += 1
        Gprev = G
        G = ecj.undersample(GG,j)
    return compat
Ejemplo n.º 6
0
def unfoldplot(G,steps=7,repeats=5,gap=0.5,R=1,hg=0.1,wgap=0.7,name='AAA',stl=''):
    u = 0
    dbnprint(undersample(G,u), repeats, w_gap=wgap,
             h_gap=hg, mname=name+str(u), type='hid', stl=stl)
    print "\\node[left="+str(gap)+"cm of "+name+str(u)+",scale=0.7] (C) {"
    print "\\begin{tikzpicture}"
    cdbnprint(G,mtype='hid',bend=15,curve=5,R=R)
    print "\\end{tikzpicture}"
    print "};"
    for u in range(1,steps):
        dbnprint(undersample(G,u),repeats,w_gap=wgap,h_gap=hg,mname=name+\
                     str(u),type='ahid',stl=', below=0.25cm of '+name+str(u-1))

        print "\\node[left="+str(gap)+"cm of "+name+str(u)+",scale=0.7] () {"
        print "\\begin{tikzpicture}"
        cdbnprint(undersample(G,u),mtype='lahid',bend=15,curve=5,R=R)
        print "\\end{tikzpicture}"
        print "};"
    emacs_vars()
Ejemplo n.º 7
0
def cdbnwrap(G,u,name='AAA',R=1,gap=0.5):
    output = StringIO.StringIO()
    print >>output,"\\node[right="+str(gap)+"cm of "+name+str(u-1)\
        +",scale=0.7]("+name+str(u)+"){"
    print >>output,"\\begin{tikzpicture}"
    s = cdbnprint(undersample(G,u),mtype='lahid',bend=25,curve=10,R=R)
    print >>output,s.getvalue()
    s.close()
    print >>output,"\\end{tikzpicture}"
    print >>output,"};"
    return output
Ejemplo n.º 8
0
def cdbnwrap(G, u, name='AAA', R=1, gap=0.5):
    output = StringIO.StringIO()
    print >>output,"\\node[right="+str(gap)+"cm of "+name+str(u-1)\
        +",scale=0.7]("+name+str(u)+"){"
    print >> output, "\\begin{tikzpicture}"
    s = cdbnprint(undersample(G, u), mtype='lahid', bend=25, curve=10, R=R)
    print >> output, s.getvalue()
    s.close()
    print >> output, "\\end{tikzpicture}"
    print >> output, "};"
    return output
Ejemplo n.º 9
0
def SM_fixed(Gstar, G, iter=5):
    compat = []
    for j in range(0, iter):
        if Gstar == ecj.undersample(G, j):
            compat.append(j)
    return compat
Ejemplo n.º 10
0
def SM_fixed(Gstar, G, iter=5):
    compat = []
    for j in range(0, iter):
        if Gstar == ecj.undersample(G, j):
            compat.append(j)
    return compat
Ejemplo n.º 11
0
def g_single(G,u,scale=0.7,R=1,gap=0.5,mtype="lahid",layout=None):
    g = undersample(G,u)
    return gsingle(g,scale=scale,R=R,gap=gap,mtype=mtype,layout=layout)
Ejemplo n.º 12
0
def cdbn_single(G,u,scale=0.7,R=1,gap=0.5,mtype="lahid"):
    return cdbnsingle(undersample(G,u),scale=scale,R=R,gap=gap,mtype=mtype)
Ejemplo n.º 13
0
def g_single(G, u, scale=0.7, R=1, gap=0.5, mtype="lahid", layout=None):
    g = undersample(G, u)
    return gsingle(g, scale=scale, R=R, gap=gap, mtype=mtype, layout=layout)
Ejemplo n.º 14
0
def cdbn_single(G, u, scale=0.7, R=1, gap=0.5, mtype="lahid"):
    return cdbnsingle(undersample(G, u),
                      scale=scale,
                      R=R,
                      gap=gap,
                      mtype=mtype)