Prune closed nodes that have no open upstream blockers

Previously only fully-closed subgraphs would be pruned, but for something
the size of Orchard this becomes rather hard to navigate. This change
reduces the size of the active DAG to solely focus on active issues.
This commit is contained in:
Jack Grigg 2021-05-24 18:58:14 +01:00
parent 32efef6cfd
commit 92acb1df11
1 changed files with 7 additions and 2 deletions

View File

@ -185,8 +185,13 @@ def main():
if len(ignore) > 0:
dg.remove_nodes_from(nx.compose_all(ignore))
# TODO:
# - Automatically prune edges between closed nodes, not just fully-closed subgraphs.
# Prune nodes that are not downstream of any open issues.
# - It would be nice to keep the most recently-closed issues on the DAG, but
# dg.out_degree seems to be broken...
to_prune = [n for (n, degree) in dg.in_degree() if degree == 0 and n.state == 'closed']
while len(to_prune) > 0:
dg.remove_nodes_from(to_prune)
to_prune = [n for (n, degree) in dg.in_degree() if degree == 0 and n.state == 'closed']
do_next = [n for (n, degree) in dg.in_degree(weight='is_open') if degree == 0 and n.state != 'closed']