From 0130ce8044e7d0998156281d7ccd7f2b4949e86a Mon Sep 17 00:00:00 2001 From: napakalas Date: Tue, 27 Jan 2026 17:30:33 +1300 Subject: [PATCH] Fix node_mappings to include contracted nodes (#174). --- mapmaker/properties/pathways.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mapmaker/properties/pathways.py b/mapmaker/properties/pathways.py index 42da2b11..5df08455 100644 --- a/mapmaker/properties/pathways.py +++ b/mapmaker/properties/pathways.py @@ -374,9 +374,12 @@ def list_to_tuple(obj): if list_to_tuple(n) in available_nodes ], 'node_mappings': [ - # mapping from rendered node to knowledge node - (list_to_tuple(connectivity_graph.nodes[node]['node']), list_to_tuple(node)) - for node in connectivity_graph.nodes + (list_to_tuple(data['node']), list_to_tuple(node)) + for node, data in connectivity_graph.nodes(data=True) + ] + [ + (list_to_tuple(cn['node']), list_to_tuple(n)) + for _, data in connectivity_graph.nodes(data=True) + for n, cn in data.get('contraction', {}).items() ] } return rendered_data