Skip to content

v0.4.0

Latest

Choose a tag to compare

@yu-ta-sato yu-ta-sato released this 11 Jun 22:20

What's Changed

v0.4.0 focuses on directed/undirected edge handling across the GeoPandas ⇄ PyTorch Geometric ⇄ NetworkX conversion pipeline, a terminology rename in the morphology module, and more robust tessellation.

Added

  • Added a directed parameter to gdf_to_pyg(). With the new default directed=False, each edge (u, v) is symmetrized by adding the reverse edge (v, u) so PyTorch Geometric receives a proper undirected graph, and pyg_to_gdf() deduplicates the edges back to the original rows on reconstruction. For heterogeneous graphs, directed also accepts a per-edge-type dictionary. Related PRs: [#157](#157)
  • Added a reverse_edge_types parameter to gdf_to_pyg() for undirected cross-type heterogeneous edges: "auto" generates (dst_type, "rev_<relation>", src_type) stores for message passing, a dict provides explicit mappings, and None enables strict mode. Related PRs: [#157](#157)
  • Added a multigraph parameter to gdf_to_pyg() that promotes two-level edge indexes to a keyed (source, target, key) contract so parallel edges round-trip exactly, and extended nx_to_pyg() / pyg_to_nx() to infer directionality from the NetworkX graph type and to preserve MultiGraph / MultiDiGraph edge keys. Related PRs: [#157](#157)
  • Added canonicalize_edges() to collapse reciprocal (u, v) / (v, u) rows and parallel duplicates in edge GeoDataFrames (duplicates="first" | "key" | "error"), and symmetrize_edges() as its idempotent inverse, appending reverse rows with reversed geometries. Related PRs: [#157](#157), [#168](#168)
  • Added a duplicate_edges parameter to the proximity generators (knn_graph(), delaunay_graph(), gabriel_graph(), relative_neighborhood_graph(), euclidean_minimum_spanning_tree(), fixed_radius_graph(), waxman_graph(), contiguity_graph()) and the morphology functions to optionally emit both (u, v) and (v, u) rows per undirected edge. Related PRs: [#168](#168)
  • Added extent_buffer, limit, and include_unenclosed_buildings parameters to morphological_graph(), a max_connection_distance parameter to place_to_movement_graph(), and a limit parameter to create_tessellation() (auto-computed as a buffered convex hull when omitted, so buildings near outer street loops are no longer dropped). Related PRs: [#164](#164)
  • Added a directed parameter to segments_to_graph(); directed=False canonicalizes each edge to an unordered (min, max) node-id order so reverse-drawn duplicate segments become parallel edges of one unordered pair. Related PRs: [#165](#165)

Changed

  • Breaking: gdf_to_pyg() now treats edges as undirected by default and validates them: edge tables containing both (u, v) and (v, u) rows (typical of OSMnx-style directed sources), or parallel rows for the same unordered pair, raise a ValueError pointing to canonicalize_edges(), multigraph=True, or directed=True as remedies. Pass directed=True to restore the previous as-is behavior. Related PRs: [#157](#157)
  • Breaking: Renamed the morphology terminology from "private"/"public" to "place"/"movement". Node keys are now "place" and "movement"; edge types are ("place", "touched_to", "place"), ("movement", "connected_to", "movement"), and ("place", "faced_to", "movement"); identifier columns are place_id, movement_id, from_place_id/to_place_id, and from_movement_id/to_movement_id. Related PRs: [#169](#169)
  • Breaking: segments_to_graph() now defaults to multigraph=True, returning a three-level (from_node_id, to_node_id, edge_key) MultiIndex (and an nx.MultiGraph when as_nx=True). With multigraph=False, duplicate node pairs now raise a ValueError instead of silently returning a duplicated MultiIndex. Related PRs: [#165](#165)
  • Updated dependencies, including requests 2.33.0, aiohttp 3.14.0, pillow 12.2.0, pytest 9.0.3, nbconvert 7.17.1, and codecov/codecov-action v7. Related PRs: [#147](#147), [#148](#148), [#149](#149), [#151](#151), [#152](#152), [#153](#153), [#158](#158), [#159](#159), [#160](#160), [#162](#162), [#163](#163)

Deprecated

  • Deprecated private_to_private_graph(), private_to_public_graph(), and public_to_public_graph() in favor of place_to_place_graph(), place_to_movement_graph(), and movement_to_movement_graph(). The old names emit a DeprecationWarning and will be removed in a future major release. Related PRs: [#169](#169)

Fixed

  • Fixed a UnicodeDecodeError in load_overture_data() when reading back files saved with save_to_file=True, by @Jah-yee. Related PRs: [#161](#161)
  • Made enclosed tessellation more robust: boundary-simplification failures retry with simplify=False, and GEOS topology errors retry with a coarser grid_size before falling back gracefully. Related PRs: [#164](#164)
  • Fixed segments_to_graph() ignoring as_nx=True for empty inputs, and segments_to_graph(multigraph=True, as_nx=True) silently collapsing parallel edges by returning an nx.Graph instead of an nx.MultiGraph. Related PRs: [#165](#165)
  • Fixed load_gtfs() UDF registration against newer DuckDB releases and guarded get_od_pairs() against an empty calendar table. Related PRs: [#170](#170)

New Contributors

Full Changelog: v0.3.1...v0.4.0