Skip to content

GraphML and GEXF

GraphML and GEXF helpers from annnet.io.graphml.

annnet.io.graphml

GraphML/GEXF import and export helpers for AnnNet.

Provides: to_graphml(G, path, ...) -> None from_graphml(path, ...) -> AnnNet to_gexf(G, path, ...) -> None from_gexf(path, ...) -> AnnNet

GraphML and GEXF support are implemented through NetworkX because NetworkX already owns mature readers and writers for these formats. This module is therefore an intentional IO-to-adapter bridge: AnnNet is first projected to a NetworkX graph, then NetworkX handles the file format.

This is an accepted boundary exception.

Classes

Functions

to_graphml
to_graphml(
    graph,
    path,
    *,
    directed=True,
    hyperedge_mode="reify",
    public_only=False
)

Export via NetworkX with reified hyperedges; sanitize attrs for GraphML.

Also writes a sidecar manifest for lossless re-import.

from_graphml
from_graphml(path, *, hyperedge='reified')

Import via NetworkX; if a sidecar manifest is present, use it as SSOT.

Otherwise, fall back to a best-effort no-manifest import with type restoration.

to_gexf
to_gexf(
    graph,
    path,
    *,
    directed=True,
    hyperedge_mode="reify",
    public_only=False
)

Export an AnnNet graph to GEXF via NetworkX.

from_gexf
from_gexf(path, *, hyperedge='reified')

Import a GEXF graph through NetworkX.