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()
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
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
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
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
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()
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
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
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
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)
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)
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)
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)