weather_model_graphs.save.to_pyg() modifies the input networkx graph in place by deleting node attributes that are not included in node_features.
The save/export function is often anticipated to be non-destructive; however, the current implementation of to_pyg() directly removes characteristics from the original graph object prior to its conversion to PyTorch Geometric format.
Expected behavior
Calling to_pyg() should export/serialize the graph without mutating the caller’s original networkx.DiGraph.
Actual behavior
Inside src/weather_model_graphs/save.py, to_pyg() removes node attributes from the original graph:
for node in graph.nodes:
for attr in list(graph.nodes[node].keys()):
if attr not in node_features:
del graph.nodes[node][attr]
weather_model_graphs.save.to_pyg()modifies the inputnetworkxgraph in place by deleting node attributes that are not included innode_features.The save/export function is often anticipated to be non-destructive; however, the current implementation of
to_pyg()directly removes characteristics from the original graph object prior to its conversion to PyTorch Geometric format.Expected behavior
Calling
to_pyg()should export/serialize the graph without mutating the caller’s originalnetworkx.DiGraph.Actual behavior
Inside
src/weather_model_graphs/save.py,to_pyg()removes node attributes from the original graph: