Skip to content

Commit

Permalink
catches division by zero for dissolve
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Oct 16, 2023
1 parent 5114782 commit 17d7a17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cityseer"
version = '4.2.1'
version = '4.2.2'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.12"
Expand Down
5 changes: 4 additions & 1 deletion pysrc/cityseer/tools/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,9 @@ def nx_weight_by_dissolved_edges(nx_multigraph: MultiGraph, dissolve_distance: i
total_lens += edge_geom.length
total_lens += nb_edge_data["nearby_itx_lens"]
# calculate ratio
g_multi_copy.nodes[nd_key]["weight"] = adjacent_lens / total_lens
weight = 1
if total_lens > dissolve_distance:
weight = adjacent_lens / total_lens
g_multi_copy.nodes[nd_key]["weight"] = weight

return g_multi_copy

0 comments on commit 17d7a17

Please sign in to comment.