Skip to content

Commit

Permalink
adds back improved closeness
Browse files Browse the repository at this point in the history
  • Loading branch information
songololo committed Dec 21, 2023
1 parent d2a2928 commit 119040e
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 75 deletions.
25 changes: 13 additions & 12 deletions docs/src/pages/metrics/networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ This effect is amplified for denser regions of the network.
- Segmentised versions of centrality measures should not be computed on dual graph topologies because street segment
lengths would be duplicated for each permutation of dual edge spanning street intersections. By way of example,
the contribution of a single edge segment at a four-way intersection would be duplicated three times.
- Global closeness is strongly discouraged because it does not behave suitably for localised graphs. Harmonic
closeness should be used instead.
- The usual formulations of closeness or normalised closeness are discouraged because these do not behave
suitably for localised graphs. Harmonic closeness or Hillier normalisation (which resembles a simplified form of
Improved Closeness Centrality proposed by Wasserman and Faust) should be used instead.
- Network decomposition can be a useful strategy when working at small distance thresholds, and confers advantages
such as more regularly spaced snapshots and fewer artefacts at small distance thresholds where street edges
intersect distance thresholds. However, the regular spacing of the decomposed segments will introduce spikes in the
Expand Down Expand Up @@ -110,9 +111,7 @@ may therefore be preferable when working at small thresholds on decomposed netwo
Compute node-based network centrality using the shortest path heuristic.
:::note
Node weights are taken into account when computing centralities. These would typically be initialised at 1 unless
manually specified. Consider use of
[`graphs.nx_weight_by_dissolved_edges`](/tools/graphs#nx-weight-by-dissolved-edges) when working with complex
network representations.
manually specified.
:::
### Parameters
<div class="param-set">
Expand Down Expand Up @@ -213,10 +212,11 @@ network representations.
| key | formula | notes |
| ----------------------| :------:| ----- |
| node_density | $$\sum_{j\neq{i}}^{n}1$$ | A summation of nodes. |
| node_farness | $$\sum_{j\neq{i}}^{n}d_{(i,j)}$$ | A summation of distances in metres. |
| node_cycles | $$\sum_{j\neq{i}j=cycle}^{n}1$$ | A summation of network cycles. |
| node_harmonic | $$\sum_{j\neq{i}}^{n}\frac{1}{Z_{(i,j)}}$$ | Harmonic closeness is an appropriate form of closeness centrality for localised implementations constrained by the threshold $d_{max}$. |
| node_harmonic | $$\sum_{j\neq{i}}^{n}\frac{1}{d_{(i,j)}}$$ | Harmonic closeness is an appropriate form of closeness centrality for localised implementations constrained by the threshold $d_{max}$. |
| node_hillier | $$\frac{(n-1)^2}{\sum_{j \neq i}^{n} d_{(i,j)}}$$ | The square of node density divided by farness. This is also a simplified form of Improved Closeness Centrality. |
| node_beta | $$\sum_{j\neq{i}}^{n} \\ \exp(-\beta\cdot d[i,j])$$ | Also known as the gravity index. This is a spatial impedance metric differentiated from other closeness centralities by the use of an explicit $\beta$ parameter, which can be used to model the decay in walking tolerance as distances increase. |
| node_cycles | $$\sum_{j\neq{i}j=cycle}^{n}1$$ | A summation of network cycles. |
| node_farness | $$\sum_{j\neq{i}}^{n}d_{(i,j)}$$ | A summation of distances in metres. |
| node_betweenness | $$\sum_{j\neq{i}}^{n}\sum_{k\neq{j}\neq{i}}^{n}1$$ | Betweenness centrality summing all shortest-paths traversing each node $i$. |
| node_betweenness_beta | $$\sum_{j\neq{i}}^{n}\sum_{k\neq{j}\neq{i}}^{n} \\ \exp(-\beta\cdot d[j,k])$$ | Applies a spatial impedance decay function to betweenness centrality. $d$ represents the full distance from any $j$ to $k$ node pair passing through node $i$. |

Expand Down Expand Up @@ -281,9 +281,7 @@ network representations.
Compute node-based network centrality using the simplest path (angular) heuristic.
:::note
Node weights are taken into account when computing centralities. These would typically be initialised at 1 unless
manually specified. Consider use of
[`graphs.nx_weight_by_dissolved_edges`](/tools/graphs#nx-weight-by-dissolved-edges) when working with complex
network representations.
manually specified.
:::
### Parameters
<div class="param-set">
Expand Down Expand Up @@ -383,7 +381,10 @@ network representations.

| key | formula | notes |
| ----------------------| :------:| ----- |
| node_harmonic_simplest | $$\sum_{j\neq{i}}^{n}\frac{1}{Z_{(i,j)}}$$ | Harmonic closeness is an appropriate form of closeness centrality for localised implementations constrained by the threshold $d_{max}$. |
| node_density_simplest | $$\sum_{j\neq{i}}^{n}1$$ | A summation of nodes. |
| node_harmonic_simplest | $$\sum_{j\neq{i}}^{n}\frac{1}{d_{(i,j)}}$$ | Harmonic closeness is an appropriate form of closeness centrality for localised implementations constrained by the threshold $d_{max}$. |
| node_hillier_simplest | $$\frac{(n-1)^2}{\sum_{j \neq i}^{n} d_{(i,j)}}$$ | The square of node density divided by farness. This is also a simplified form of Improved Closeness Centrality. |
| node_farness_simplest | $$\sum_{j\neq{i}}^{n}d_{(i,j)}$$ | A summation of distances in metres. |
| node_betweenness_simplest | $$\sum_{j\neq{i}}^{n}\sum_{k\neq{j}\neq{i}}^{n}1$$ | Betweenness centrality summing all shortest-paths traversing each node $i$. |

The following keys use the simplest-path (shortest-angular-path) heuristic, and are available when the `angular` parameter is explicitly set to `True`:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/rustalgos/rustalgos.md
Original file line number Diff line number Diff line change
Expand Up @@ -2726,7 +2726,7 @@ datapoints are not located with high spatial precision.



<span class="name">node_xs</span><span class="annotation">: list[float]</span>
<span class="name">node_lives</span><span class="annotation">: list[bool]</span>



Expand All @@ -2741,7 +2741,7 @@ datapoints are not located with high spatial precision.



<span class="name">node_lives</span><span class="annotation">: list[bool]</span>
<span class="name">node_xs</span><span class="annotation">: list[float]</span>



Expand Down
66 changes: 33 additions & 33 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.7'
version = '4.6.8'
description = "Computational tools for network-based pedestrian-scale urban analysis"
readme = "README.md"
requires-python = ">=3.10, <3.12"
Expand Down
Loading

0 comments on commit 119040e

Please sign in to comment.