*digraph_print
This commit is contained in:
parent
731f7acc93
commit
85a03a7794
18
srcxray.py
18
srcxray.py
|
@ -375,20 +375,24 @@ def digraph_print(dg):
|
||||||
if level > level_limit - 2:
|
if level > level_limit - 2:
|
||||||
return ''
|
return ''
|
||||||
passed = set()
|
passed = set()
|
||||||
for o in outs:
|
for o in outs.keys():
|
||||||
if o in passed or o in black_list:
|
if o in passed or o in black_list:
|
||||||
continue
|
continue
|
||||||
passed.add(o)
|
passed.add(o)
|
||||||
digraph_print_sub(o, printed, level + 1)
|
digraph_print_sub(o, printed, level + 1)
|
||||||
|
|
||||||
starts = {}
|
|
||||||
printed = set()
|
printed = set()
|
||||||
for i in [n for (n, d) in dg.in_degree if not d]:
|
if not starts:
|
||||||
starts[i] = dg.out_degree(i)
|
starts = {}
|
||||||
starts = sorted(starts.items(), key=lambda k: k[1], reverse=True)
|
for i in [n for (n, d) in dg.in_degree if not d]:
|
||||||
outs = [a[0] for a in starts]
|
starts[i] = dg.out_degree(i)
|
||||||
|
starts = [a[0] for a in sorted(starts.items(), key=lambda k: k[1], reverse=True)]
|
||||||
|
if len(starts) > 1:
|
||||||
|
print_limited('starts')
|
||||||
|
for s in starts:
|
||||||
|
print_limited('\t' + s + ' ->')
|
||||||
passed = set()
|
passed = set()
|
||||||
for o in outs:
|
for o in starts:
|
||||||
if o in passed or o in black_list:
|
if o in passed or o in black_list:
|
||||||
continue
|
continue
|
||||||
passed.add(o)
|
passed.add(o)
|
||||||
|
|
Loading…
Reference in New Issue