liveBook · Manning

Closeness centrality

As explained in Graph Algorithms for Data Science

Closeness centrality is a network metric based on the inverse of the sum of shortest-path distances from a node to all other reachable nodes, indicating how quickly the node can reach the network.

Closeness centrality measures how close a node is to every other node in a network. It calculates shortest paths from the node, sums their distances, and returns the inverse of that sum, so higher scores indicate faster potential reach. section 8.1.3

The metric helps interpret a node’s global position. In a follower network, a highly central node may disseminate information quickly; in a character network, nodes near the center receive higher scores than peripheral nodes. section 8.0 section 8.1.3

When applying the metric, keep these points in mind:

  • Use a disconnected-graph variation when shortest paths do not exist between every pair of nodes; the example uses the Wasserman and Faust variation. section 8.1.3
  • Compare scores with the network structure rather than treating them as a universal measure of importance; closeness captures rapid reach, while betweenness captures bridge positions. section 8.0 section 8.5
  • Inspect the score distribution before using closeness as a feature; the demonstrated values range from 0.0 to 0.25, with an average of 0.04. section 8.2.1

Mutating closeness in a projected graph

In Neo4j Graph Data Science, calculate and retain the metric on the in-memory graph with: CALL gds.closeness.mutate('knnExample', {mutateProperty:'closeness', useWassermanFaust: true}). The resulting property can then be inspected alongside other user features. section 8.1.3 section 8.2.1

Listing 8.4 Mutating the closeness centrality algorithm
CALL gds.closeness.mutate('knnExample',
 {mutateProperty:'closeness', useWassermanFaust: true})

Shows the Cypher call for mutating closeness centrality with the Wasserman and Faust option enabled. section 8.1.3

How Graph Algorithms for Data Science covers it

How deep it goes
Explains shortest-path calculation, inverse distance sums, disconnected-graph handling, and GDS mutation, without deriving formulas.
Examples
Uses Twitter follower networks, a Marvel character network, and user-feature distributions as concrete examples.
What you can do after
Apply it via Neo4j Graph Data Science to mutate closeness scores on an in-memory graph.
How it connects
Connects shortest paths with betweenness centrality, network roles, disconnected graphs, and feature analysis.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.