pythonnetworkx

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?


Solution

  • 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.