The "cost" used in the betweenness centrality calculation
5 views (last 30 days)
Show older comments
For weighted networks, in the command "centrality(G,'betweenness','Cost',G.Edges.Weight)", betweenness means shortest paths between other nodes that pass through node i, so when finding out the shortest path, I think the Dijkstra’s algorithm is adopted. So my question is: the weights of links are directly used in the Dijkstra’s algorithm as "cost" or the weights are reversed firstly and then used for finding the shortest path. In summary, what I am asking is the "cost" used in the "centrality(G,'betweenness','Cost',G.Edges.Weight)" is the weights directly or reversed, i.e., higher weight is (1) higher cost and longer distance or (2) lower cost and shorter distance. I appreciate anyone's help regarding this question. Thank you very much.
0 Comments
Answers (1)
Paras Gupta
on 28 Jun 2022
Hi,
It is my understanding that you want to know whether weights are inversed or not when using the ‘betweenness centrality’ measure function in MATLAB. The short answer is ‘NO, the weights are not inversed’.
For measures like the ‘betweenness centrality’, the higher the total edge weight is between any two given nodes, the greater would be the 'cost' between them (or a larger distance between the two nodes). This generally works for cases when the edge weights themselves represent the farness between the edge nodes.
centrality(G,'betweenness','Cost',1./(G.Edges.Weight));
In case the edge weights in your network represent some form of importance between the edge nodes, you can inverse the weights using the element-wise division operation before using the 'betweenness centrality' function (scaling the inversed weights can also be done if required).
You can refer to the documentation of centrality measure functions for more information on the interpretation of the 'cost' argument.
Hope this helps!
1 Comment
Christine Tobler
on 28 Jun 2022
Yes, the weights are not used by default in the centrality function, while they are used for example in shortestpath. There's an example in the doc related to betweenness centrality which shows this: Closeness and Betweenness of Minnesota Roads
The reason is just as Paras explained, since centrality measures have two different notions of edge weights, we have these be specified explicitly through the "Cost" or "Importance" flag, depending which notion of edge weight each centrality measure uses. That way, it's explicit whether a larger weight means a larger distance between nodes, or a larger importance of the connection between two nodes.
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!