stats: +couples

This commit is contained in:
Costa Shulyupin 2018-08-12 23:28:19 +03:00
parent e9a1a576b1
commit b19cb8fdc3
1 changed files with 3 additions and 0 deletions

View File

@ -787,6 +787,7 @@ def stats(a):
leaves = set() leaves = set()
roots = set() roots = set()
stat.edge_nodes = 0 stat.edge_nodes = 0
stat.couples = 0
for n in dg: for n in dg:
id = dg.in_degree(n) id = dg.in_degree(n)
od = dg.out_degree(n) od = dg.out_degree(n)
@ -800,6 +801,8 @@ def stats(a):
om[n] = od om[n] = od
else: else:
leaves.add(n) leaves.add(n)
if od == 1 and dg.in_degree(list(dg.successors(n))[0]) == 1:
stat.couples += 1
stat.max_in_degree = max(dict(dg.in_degree).values()) stat.max_in_degree = max(dict(dg.in_degree).values())
stat.max_out_degree = max(dict(dg.out_degree).values()) stat.max_out_degree = max(dict(dg.out_degree).values())
stat.leaves = len(leaves) stat.leaves = len(leaves)