NetworkX 3.0 GraphML Writer: Handling of 'edgedefault' and Node ID Conversion
0 reputation · 16 May 2024, 13:31 UTC
GraphML Writer/Reader Changes
NetworkX 3.0 now writes an explicit edgedefault attribute (directed or undirected) in GraphML files, replacing the prior implicit inference from the graph type. The reader no longer infers directedness when this attribute is missing; it defaults to undirected and issues a warning if directed edges are present.
Additionally, node identifiers of non‑string or non‑int types are silently converted to strings during read/write, which can alter the graph structure when reloaded. Edge attributes not defined in the GraphML schema are dropped, and the writer no longer accepts an encoding keyword argument, potentially causing errors with non‑ASCII data.
These changes create unresolved decisions regarding how to preserve node types, manage directedness inference, and support encoding when writing GraphML.
Unresolved Questions
- Should the GraphML reader explicitly error or provide a mapping when
edgedefaultis missing but directed edges exist? - Is there a mechanism to preserve non‑string node identifiers without altering the graph upon round‑trip?
- Should the writer re‑introduce an
encodingparameter to handle non‑ASCII characters reliably?