This commit is contained in:
Costa Shulyupin 2018-08-27 10:30:29 +03:00
parent c75e73b214
commit a0c277929b
1 changed files with 12 additions and 2 deletions

View File

@ -627,6 +627,8 @@ def import_cflow(a=None, cflow_out=None):
def rank(g, n): def rank(g, n):
try: try:
if g.nodes[n]['rank1'] == g.nodes[n]['rank2']:
return g.nodes[n]['rank1']
if g.nodes[n]['rank1'] < abs(g.nodes[n]['rank2']): if g.nodes[n]['rank1'] < abs(g.nodes[n]['rank2']):
return g.nodes[n]['rank1'] return g.nodes[n]['rank1']
else: else:
@ -654,7 +656,7 @@ def write_dot(g, dot):
continue continue
dot.write('"%s" -> { ' % (n)) dot.write('"%s" -> { ' % (n))
dot.write(' '.join(['"%s"' % (str(a)) for a in g.successors(n)])) dot.write(' '.join(['"%s"' % (str(a)) for a in g.successors(n)]))
if r and scaled: if scaled and r and int(r):
dot.write(' } [penwidth=%d label=%d];\n' % (100/r, r)) dot.write(' } [penwidth=%d label=%d];\n' % (100/r, r))
else: else:
dot.write(' } ;\n') dot.write(' } ;\n')
@ -668,6 +670,8 @@ def write_dot(g, dot):
# prop.label = n + ' ' + str(rank(g,n)) # prop.label = n + ' ' + str(rank(g,n))
if prop: if prop:
dot.write('"%s" [%s]\n' % (n, ','.join(['%s="%s"' % (a, str(prop[a])) for a in prop]))) dot.write('"%s" [%s]\n' % (n, ','.join(['%s="%s"' % (a, str(prop[a])) for a in prop])))
elif not g.number_of_edges():
dot.write('"%s"\n' % (n))
# else: # else:
# dot.write('"%s"\n'%(n)) # dot.write('"%s"\n'%(n))
dot.write('}\n') dot.write('}\n')
@ -692,6 +696,12 @@ def read_dot2(dot):
dg.add_edge(m.group(1), m.group(2)) dg.add_edge(m.group(1), m.group(2))
else: else:
log(a) log(a)
else:
m = re.match('"?([^"]+)"?', a)
if m:
if m.group(1):
dg.add_node(m.group(1))
return dg return dg