Skip to content

Commit

Permalink
improved closeness formula
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Dec 22, 2023
1 parent 119040e commit 3fdae4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 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.6.8'
version = '4.7.0'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.12"
Expand Down
4 changes: 2 additions & 2 deletions pysrc/cityseer/metrics/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def node_centrality_shortest(
nodes_gdf[data_key] = getattr(result, measure_name)[distance]
for distance in distances: # type: ignore
data_key = config.prep_gdf_key(f"node_hillier_{distance}")
nodes_gdf[data_key] = result.node_density[distance] / result.node_farness[distance] # type: ignore
nodes_gdf[data_key] = result.node_density[distance] ** 2 / result.node_farness[distance] # type: ignore
if compute_betweenness is True:
for measure_name in ["node_betweenness", "node_betweenness_beta"]:
for distance in distances: # type: ignore
Expand Down Expand Up @@ -287,7 +287,7 @@ def node_centrality_simplest(
nodes_gdf[data_key] = result.node_harmonic[distance] # type: ignore
for distance in distances: # type: ignore
data_key = config.prep_gdf_key(f"node_hillier_simplest_{distance}")
nodes_gdf[data_key] = result.node_density[distance] / result.node_farness[distance] # type: ignore
nodes_gdf[data_key] = result.node_density[distance] ** 2 / result.node_farness[distance] # type: ignore
for distance in distances: # type: ignore
data_key = config.prep_gdf_key(f"node_farness_simplest_{distance}")
nodes_gdf[data_key] = result.node_farness[distance] # type: ignore
Expand Down
4 changes: 2 additions & 2 deletions tests/metrics/test_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_node_centrality_shortest(primal_graph):
)
assert np.allclose(
nodes_gdf[config.prep_gdf_key(f"node_hillier_{distance}")],
node_result_short.node_density[distance] / node_result_short.node_farness[distance],
node_result_short.node_density[distance] ** 2 / node_result_short.node_farness[distance],
equal_nan=True,
atol=config.ATOL,
rtol=config.RTOL,
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_node_centrality_simplest(primal_graph):
)
assert np.allclose(
nodes_gdf[config.prep_gdf_key(f"node_hillier_simplest_{distance}")],
node_result_simplest.node_density[distance] / node_result_simplest.node_farness[distance],
node_result_simplest.node_density[distance] ** 2 / node_result_simplest.node_farness[distance],
equal_nan=True,
atol=config.ATOL,
rtol=config.RTOL,
Expand Down

0 comments on commit 3fdae4e

Please sign in to comment.