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
directedparameter togdf_to_pyg(). With the new defaultdirected=False, each edge(u, v)is symmetrized by adding the reverse edge(v, u)so PyTorch Geometric receives a proper undirected graph, andpyg_to_gdf()deduplicates the edges back to the original rows on reconstruction. For heterogeneous graphs,directedalso accepts a per-edge-type dictionary. Related PRs: [#157](#157) - Added a
reverse_edge_typesparameter togdf_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, andNoneenables strict mode. Related PRs: [#157](#157) - Added a
multigraphparameter togdf_to_pyg()that promotes two-level edge indexes to a keyed(source, target, key)contract so parallel edges round-trip exactly, and extendednx_to_pyg()/pyg_to_nx()to infer directionality from the NetworkX graph type and to preserveMultiGraph/MultiDiGraphedge 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"), andsymmetrize_edges()as its idempotent inverse, appending reverse rows with reversed geometries. Related PRs: [#157](#157), [#168](#168) - Added a
duplicate_edgesparameter 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, andinclude_unenclosed_buildingsparameters tomorphological_graph(), amax_connection_distanceparameter toplace_to_movement_graph(), and alimitparameter tocreate_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
directedparameter tosegments_to_graph();directed=Falsecanonicalizes 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 aValueErrorpointing tocanonicalize_edges(),multigraph=True, ordirected=Trueas remedies. Passdirected=Trueto 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 areplace_id,movement_id,from_place_id/to_place_id, andfrom_movement_id/to_movement_id. Related PRs: [#169](#169) - Breaking:
segments_to_graph()now defaults tomultigraph=True, returning a three-level(from_node_id, to_node_id, edge_key)MultiIndex (and annx.MultiGraphwhenas_nx=True). Withmultigraph=False, duplicate node pairs now raise aValueErrorinstead of silently returning a duplicated MultiIndex. Related PRs: [#165](#165) - Updated dependencies, including
requests2.33.0,aiohttp3.14.0,pillow12.2.0,pytest9.0.3,nbconvert7.17.1, andcodecov/codecov-actionv7. 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(), andpublic_to_public_graph()in favor ofplace_to_place_graph(),place_to_movement_graph(), andmovement_to_movement_graph(). The old names emit aDeprecationWarningand will be removed in a future major release. Related PRs: [#169](#169)
Fixed
- Fixed a
UnicodeDecodeErrorinload_overture_data()when reading back files saved withsave_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 coarsergrid_sizebefore falling back gracefully. Related PRs: [#164](#164) - Fixed
segments_to_graph()ignoringas_nx=Truefor empty inputs, andsegments_to_graph(multigraph=True, as_nx=True)silently collapsing parallel edges by returning annx.Graphinstead of annx.MultiGraph. Related PRs: [#165](#165) - Fixed
load_gtfs()UDF registration against newer DuckDB releases and guardedget_od_pairs()against an empty calendar table. Related PRs: [#170](#170)
New Contributors
Full Changelog: v0.3.1...v0.4.0