Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python networkx: do networkx's centrality algorithms use a weighted adjacency matrix?

I'm using networkx to compute a couple centrality statistics for a weighted graph (eigenvector centrality, and katz centrality). The documentation for these methods mention the graph's adjacency matrix, but do they use the weighted or unweighted version of this matrix?

like image 652
qua Avatar asked Apr 26 '26 14:04

qua


1 Answers

Both of those algorithms as implemented in NetworkX will use edge weights if specified with the edge attribute 'weight' (for each edge). If you do not specify a weight on the edge the numeric value 1 will be used.

This is very unclear from the documentation. I've opened an issue at https://github.com/networkx/networkx/issues/920 so the developers fix this.

like image 115
Aric Avatar answered Apr 29 '26 03:04

Aric