I want to use network centrality to a similarity matrix. It means that I have a similarity matrix as below:
similarity matrix:[[1,0.1,1,0.4],
[0.13,1,0.9,0.6],
[0.6,0.1,1,0.11],
[0.5,0.23,0.43,1]]
Then I created a weighted graph for this matrix. But I don't know how can I create eigenvector centrality for this graph. I used from below code to do this:
centrality = nx.eigenvector_centrality_numpy(G, weight='weight')
But can anybody help me to know what means weight in this code? what should I replace instead of it? my graph is weighted by itself. How can I show it in this code?
So if you created the graph in the following way:
then the graph is weighted by default with your weights. Each edge has an attribute 'weight'. You can test it by running the following code:
You can define different attributes to each edge/node see networkx documentation
Therefore when you use eigenvector_centrality_numpy you can define the attribute for the weight. In your case it 'weight' which also a default in documentation.