fix: allow for nodes without any edges (e.g. new player)

This commit is contained in:
julius 2025-03-24 13:35:36 +01:00
parent c04a1e03f2
commit e88eb02ef1
Signed by: julius
GPG Key ID: C80A63E6A5FD7092

@ -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 = [