From e88eb02ef1591854cb423e5988973bb62421bd05 Mon Sep 17 00:00:00 2001 From: julius Date: Mon, 24 Mar 2025 13:35:36 +0100 Subject: [PATCH] fix: allow for nodes without any edges (e.g. new player) --- cutt/analysis.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cutt/analysis.py b/cutt/analysis.py index 351c606..439c5f0 100644 --- a/cutt/analysis.py +++ b/cutt/analysis.py @@ -116,6 +116,7 @@ def graph_json( status_code=status.HTTP_404_NOT_FOUND, detail="no entries found" ) G = nx.DiGraph() + G.add_nodes_from([n["id"] for n in nodes]) G.add_weighted_edges_from([(e["source"], e["target"], e["size"]) for e in edges]) in_degrees = G.in_degree(weight="weight") nodes = [