What is centrality?
iFull definition for centrality (opens in a new tab)How important a node is within a graph. Each centrality algorithm defines importance differently. algorithms are often described as finding the "most important" or "most influential" iFull definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties..
While that description is technically valid, they each define importance in different ways — sometimes extremely different.
In this lesson, you'll:
- Count the iFull definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node. on a small graph and rank its nodes by hand
- Meet the six families of similar centrality algorithms
- Work out which node each family might identify on that same graph
By the end of this lesson, you will understand what centrality means, and how each algorithm family defines it differently.
A sample graph
Every centrality algorithm provides each node with a score, ranking nodes by importance. Each algorithm's definition of "importance" varies.
In this lesson, you will consider how these behaviors interact with the following example graph; it holds eight nodes and nine relationships.
The six families
For mnemonic purposes, we can arrange centrality algorithms into six loose families.
| Family | Perspective | Algorithms | The question it answers |
|---|---|---|---|
| Ties | at the node | Degree | How many relationships does this node have? |
| Articulation | without the node | Articulation Points, Bridges | Which nodes or relationships, if removed, would break the graph into more components? |
| Reach | from the node | Closeness, Harmonic | How far is this node from every other node? |
| Gatekeeping | through the node | Betweenness | How many of the shortest paths between other nodes run through this one? |
| Endorsement | into the node | Page Rank, Article Rank, Eigenvector, HITS | How important are the nodes that point at this node? |
| Teams | with other nodes | CELF | Which group of nodes together reaches the most of the graph? |
The six initials spell TARGET.
Although there are behavioral variations, even within each family, family-members share a certain approach or perspective.
For some families, the iGo to glossary for graph data science (opens in a new tab)Analysing data through the structure of its connections. Also the name of the Neo4j library that implements it. library contains many variations on a theme. For others, it provides only one.
Ties
Algorithms in the Ties family describe each node's local characteristics.
Count the relationships on each node in the example graph, then compare your counts with the table that follows.
▶Reveal the relationship counts
| Node | Relationships | Connected to |
|---|---|---|
| Bridget | 4 | Eve, Farida, Alice, Cesar |
| Alice | 3 | Bridget, Cesar, Dmitri |
| Dmitri | 3 | Alice, Mark, Mehmet |
| Cesar | 2 | Alice, Bridget |
| Mark | 2 | Dmitri, Mehmet |
| Mehmet | 2 | Dmitri, Mark |
| Eve | 1 | Bridget |
| Farida | 1 | Bridget |
Bridget holds the most relationships, at four.
An algorithm in the Ties family would identify Bridget as the most "important" node.
The Graph Data Science library offers iFull definition for degree centrality (opens in a new tab)A score for each node equal to its number of outgoing relationships. as the only member of this family.
Articulation
Algorithms in the Articulation family rank nodes and/or relationships by their "importance" to structure.
Go back to your example graph. Consider what would happen to the entire graph if you removed one, and only one, node. Run the experiment for all nodes.
The following table outlines what would happen.
▶Reveal what happens
| Node removed | What happens |
|---|---|
| Bridget | Eve and Farida each lose their only route |
| Alice | Dmitri, Mark and Mehmet lose every route to the rest |
| Dmitri | Mark and Mehmet lose every route to the rest |
| Cesar | nothing, Alice and Bridget are still joined |
| Mark | nothing, Dmitri and Mehmet are still joined |
Alice, Bridget and Dmitri would be considered "important" by an algorithm in the Articulation family — removing them would break the graph into pieces.
The Graph Data Science Library provides Articulation Points and Bridges as members of this family.
Reach
Algorithms in the Reach family rank nodes by how far they sit from every other node.
Pick two nodes in the example graph. Count the hops along the shortest path from each one to the other seven nodes. Then, decide which one can reach more nodes, faster than the other.
The following table holds the full count for every node.
▶Reveal the hop counts
| Node | Total hops to the other seven | Hops to the farthest node |
|---|---|---|
| Alice | 11 | 2 |
| Bridget | 12 | 3 |
| Dmitri | 13 | 3 |
| Cesar | 14 | 3 |
| Eve | 18 | 4 |
| Farida | 18 | 4 |
| Mark | 18 | 4 |
| Mehmet | 18 | 4 |
Alice reaches the other seven nodes in eleven hops. Bridget, on four relationships, requires twelve hops. Dmitri, on three relationships like Alice, requires thirteen hops.
Algorithms of the Reach family could identify either Alice or Bridget as the most "important" nodes.
The Graph Data Science library provides Closeness Centrality and Harmonic Centrality as members of this family.
Gatekeeping
Algorithms in the Gatekeeping family rank nodes by how often they sit on the shortest path between two other nodes. They consider a node's position relative to every other node in the graph.
Take a look at your example graph. See if you can intuit which node would lie on the most shortest paths between all pairs.
The following table counts the pairs whose shortest path runs through each node.
▶Reveal the shortest path counts
| Node | Shortest paths through it, of 21 | An example pair |
|---|---|---|
| Alice | 12 | Mark to Cesar |
| Bridget | 11 | Eve to Farida |
| Dmitri | 10 | Mehmet to Alice |
| Cesar | 0 | none |
| Eve | 0 | none |
| Farida | 0 | none |
| Mark | 0 | none |
| Mehmet | 0 | none |
Alice sits on the shortest path for twelve pairs, more than any other node.
Bridget holds one relationship more than Alice, but, at eleven pairs, an algorithm in the Gatekeeping family would still rank Bridget lower than Alice.
Cesar, Eve, Farida, Mark and Mehmet sit on no shortest path at all.
The Graph Data Science library offers iFull definition for betweenness centrality (opens in a new tab)A score for each node equal to how often it lies on the shortest paths between other nodes. as the only member of this family.
Endorsement
Algorithms in the Endorsement family rank nodes by the importance of the nodes attached to them. A relationship from a high scorer is worth more than a relationship from a low-scoring node.
Go back to your example graph. Take each node in turn, and count the relationships held by each of its neighbours.
The following table ranks each node by the number of relationships held by its neighbors.
▶Reveal the neighbour counts
| Node | Neighbours, and the relationships each holds | Total |
|---|---|---|
| Alice | Bridget 4, Dmitri 3, Cesar 2 | 9 |
| Bridget | Alice 3, Cesar 2, Eve 1, Farida 1 | 7 |
| Cesar | Bridget 4, Alice 3 | 7 |
| Dmitri | Alice 3, Mark 2, Mehmet 2 | 7 |
| Mark | Dmitri 3, Mehmet 2 | 5 |
| Mehmet | Dmitri 3, Mark 2 | 5 |
| Eve | Bridget 4 | 4 |
| Farida | Bridget 4 | 4 |
Cesar and Bridget receive the same rank. But Cesar has only two relationships to Bridget's four.
Cesar receives more endorsement than Bridget because both of his neighbors have relationships of their own. Those neighbors, in turn, have relationships of their own.
Every node's score depends on the scores of its neighbours. Those neighbour scores are themselves still being worked out. Each algorithm in this family resolves that circularity by iterating over the graph until the scores stop moving.
The Graph Data Science library provides Page Rank, Article Rank, Eigenvector Centrality and HITS as members of this family.
Teams
Algorithms in the Teams family score a group of nodes rather than a single node.
Go back to your example graph. Try to intuit which two nodes together would reach the greatest number of nodes.
The following table holds that count for four of the best possible teams.
▶Reveal the team counts
| Team of two | Nodes each reaches alone | Nodes the team reaches, of 8 |
|---|---|---|
| Bridget and Dmitri | 5 and 4 | 8 |
| Bridget and Mark | 5 and 3 | 8 |
| Bridget and Alice | 5 and 4 | 6 |
| Alice and Dmitri | 4 and 4 | 6 |
Bridget and Alice, together, reach nine nodes. However, three of those are overlapping — they can both reach them. Combined, they reach only six unique nodes.
Bridget and Mark, together, reach eight nodes. However, every node they reach is unique, so they retain their score of eight.
A node that reaches a great many nodes adds little to a team when somebody already chosen reaches the same nodes.
The Graph Data Science library offers CELF (Cost-Effective Lazy Forward) as the only member of this family.
There's more to the Graph Data Science library than these algorithms alone.
The Graph Data Science library also allows you to define your own algorithms using the Pregel API.
In most cases, you will not need to define custom algorithms. The library's native set provides you with most of the functionality you will ever need for most use-cases.
That said, it is useful to retain the loose family designations outlined here, should you ever decide to branch out.
What centrality means
Each of the families you have just considered defines "centrality" or "importance" differently.
How those differences impact your analyses relies on your analytical intent.
To make each one more comprehensible, you could reframe their behaviors as questions, instead.
| Family | The question you are asking |
|---|---|
| Ties | Which node holds the most direct ties to other nodes? |
| Articulation | Which node would break the graph by leaving? |
| Reach | Which node reaches the most other nodes? |
| Gatekeeping | Which nodes control the flow of information? |
| Endorsement | Which node is attached to the most important nodes? |
| Teams | Which nodes, together, reach the most of the graph? |
These are generalized examples — your specific questions could differ, depending on your graph's structure.
Regardless, you can pick the family required by identifying which of these kinds of questions the algorithm could answer.
Check your understanding
Sign in to test your knowledge with interactive questions, track your progress, and earn a certificate when you complete the course.
Sign in or register