iduedu.write_urban_graph

iduedu.write_urban_graph(graph, path, *, include_adjacency=False)[source]

Write an UrbanGraph to an .urbangraph archive.

The archive contains metadata.json, nodes.parquet and edges.parquet. If include_adjacency is true and the graph has a cached adjacency matrix, the cache is stored as adjacency.npz together with its nodelist.

Parameters:
  • graph (UrbanGraph) – Graph to serialize.

  • path (str | Path) – Destination path with the .urbangraph suffix.

  • include_adjacency (bool) – Whether to persist the cached adjacency matrix.

Return type:

Path

Returns:

Path to the written archive.

Raises:
  • TypeError – If graph is not an UrbanGraph.

  • ValueError – If path does not use the .urbangraph suffix.

  • ImportError – If parquet support is not installed.