In graph theory, the Katz centrality of a node is a measure of centrality in a network. It was introduced by Leo Katz in 1953 and is used to measure the relative degree of influence of an actor (or node) within a social network. Unlike typical centrality measures which consider only the shortest path (the geodesic) between a pair of actors, Katz centrality measures influence by taking into account the total number of walks between a pair of actors.
It is similar to Google’s PageRank and to the eigenvector centrality.
Measuring Katz centrality
Katz centrality computes the relative influence of a node within a network by measuring the number of the immediate neighbors (first degree nodes) and also all other nodes in the network that connect to the node under consideration through these immediate neighbors. Connections made with distant neighbors are, however, penalized by an attenuation factor . Each path or connection between a pair of nodes is assigned a weight determined by and the distance between nodes as .
For example, in the figure on the right, assume that John’s centrality is being measured and that . The weight assigned to each link that connects John with his immediate neighbors Jane and Bob will be . Since Jose connects to John indirectly through Bob, the weight assigned to this connection (composed of two links) will be . Similarly, the weight assigned to the connection between Agneta and John through Aziz and Jane will be and the weight assigned to the connection between Agneta and John through Diego, Jose and Bob will be .
Let A be the adjacency matrix of a network under consideration. Elements of A are variables that take a value 1 if a node i is connected to node j and 0 otherwise. The powers of A indicate the presence (or absence) of links between two nodes through intermediaries. For instance, in matrix , if element , it indicates that node 2 and node 12 are connected through some first and second degree neighbors of node 2. If denotes Katz centrality of a node i, then mathematically:
Note that the above definition uses the fact that the element at location of the adjacency matrix raised to the power (i.e. ) reflects the total number of degree connections between nodes and . The value of the attenuation factor has to be chosen such that it is smaller than the reciprocal of the absolute value of the largest eigenvalue of the adjacency matrix A. In this case the following expression can be used to calculate Katz centrality:
Here is the identity matrix, is an identity vector of size n (n is the number of nodes) consisting of ones. denotes the transposed matrix of A and ( denotes matrix inversion of the term ( ).
Following is the code for the calculation of the Katz Centrality of the graph and its various nodes.
The above function is invoked using the networkx library and once the library is installed, you can eventually use it and the following code has to be written in python for the implementation of the katz centrality of a node.
The output of the above code is:
The above result is a dictionary depicting the value of katz centrality of each node. The above is an extension of my article series on the centrality measures. Keep networking!!!
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Degree Centrality (Centrality Measure)
- Betweenness Centrality (Centrality Measure)
- Network Centrality Measures in a Graph using Networkx | Python
- ML | V-Measure for Evaluating Clustering Performance
- Python - Measure time taken by program to execute
- Statistical Functions in Python | Set 2 ( Measure of Spread)
- Statistical Functions in Python | Set 1 (Averages and Measure of Central Location)
- Python | Measure similarity between two sentences using cosine similarity
- Minimum nodes to be colored in a Graph such that every node has a colored neighbour
- Finding shortest path between any two nodes using Floyd Warshall Algorithm
- Proof that Clique Decision problem is NP-Complete | Set 2
- COVID-19 Peak Prediction using Logistic Function
- Get the number of rows and number of columns in Pandas Dataframe
- How to create an empty DataFrame and append rows & columns to it in Pandas?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.