0

If I have a file like this,

 "38" "424" "23" 
 "5" "960" "34" 
 "1023" "1294" "5"
..................

where the first two columns represent the nodes and the third column represent the weights on those edges. I want to know after making a graph with those edges, how can I calculate the assortativity coefficient on the basis of the weights on those edges. I know how to calculate on the basis of degree, or the edge labels but on the basis of weight, how can we do that?

user3845968
  • 113
  • 7
  • If you know how to calculate it based on basis of degree and the edge labels, it probably would help to include that code here. You're likely to get more useful responses if you inlcude a more complete [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) (including the value of the desired output so we can make sure a suggestion works). And when dealing with technical terms like "assortativity coefficient", it's best to at least give a link the the definition if you are unable to define it in place. – MrFlick Jul 23 '14 at 15:12

1 Answers1

0

Perhaps this is what you want.

assortativity(graph, graph.strength(graph))

graph.strength is the "weighted degree", i.e. sum of the weights of all incident edges, for each vertex.

Gabor Csardi
  • 10,705
  • 1
  • 36
  • 53