The check that the number of outgoing links is maximal was:
((a.node[p]['sbla'] and a.out_degree(p) >= 40) or (a.out_degree(p) >= 8))
which is incorrect, as the second clause, and thus the whole expression was evaluating to True if out_degree is >= 8.
So essentially the SBLA flag was ignored.
Fix this by extracting the correct reverse check from try_reduce_out_degree to a separate function, and using negation of this check when needed.
The check that the number of outgoing links is maximal was: ((a.node[p]['sbla'] and a.out_degree(p) >= 40) or (a.out_degree(p) >= 8)) which is incorrect, as the second clause, and thus the whole expression was evaluating to True if out_degree is >= 8. So essentially the SBLA flag was ignored. Fix this by extracting the correct reverse check from try_reduce_out_degree to a separate function, and using negation of this check when needed.