From 92acb1df116fcd2d6a17b4a5715d1d2b32ef09bc Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 24 May 2021 18:58:14 +0100 Subject: [PATCH] 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. --- zcash-core-graph.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zcash-core-graph.py b/zcash-core-graph.py index dea782fd..aac1750d 100755 --- a/zcash-core-graph.py +++ b/zcash-core-graph.py @@ -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']