Some graphs are made of several components, meaning some nodes are totally disconnected from others. This was the case for the US states graph we built in Chapter 2, The Cypher Query Language, because some states do not share borders with any other state. In such cases, the distance between nodes in two disconnected components is infinite and the centrality of all the nodes drops to 0. Because of that, the centrality algorithm in GDS implements a slightly modified version of the closeness centrality formula, where the sum of distances is performed over all the nodes in the same component. In the next chapter, Chapter 7, Community Detection and Similarity Measures, we will discover how to find nodes belonging to the same component.
In the next section, we are going to learn about another way to measure centrality using a path-based technique: betweenness centrality.