title: How do I calculate weighted degree distributions with igraph in R?
body: <p>Consider a dataframe <code>df</code> where the first two columns are node pairs and successive columns <code>V1</code>, <code>V2</code>, ..., <code>Vn</code> represent flows between the nodes (potentially 0, implying no edge for that column's network). I would like to conduct analysis on degree, community detection, and other network measures using the flows as weights. </p>
  
  <p>Then to analyze the graph with respect to the weights in <code>V1</code> I do:</p>
  
  <pre><code># create graph and explore unweighted degrees with respect to V1
  g &lt;- graph.data.frame( df[df$V1!=0,] )
  qplot(degree(g))
  x &lt;- 0:max(degree(g))
  qplot(x,degree.distribution(g))
  
  # set weights and explore weighted degrees using V1
  E(g)$weights &lt;- E(g)$V1
  qplot(degree(g))
  </code></pre>
  
  <p>The output from the third qplot is no different than the first. What am I doing wrong?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>So <a href="http://igraph.sourceforge.net/doc/R/graph.strength.html" rel="noreferrer"><code>graph.strength</code></a> is what I am looking for, but <code>graph.strength(g)</code> in my case gives standard degree output followed by:</p>
  
  <pre><code>Warning message:
  In graph.strength(g) :
  At structural_properties.c:4928 :No edge weights for strength calculation,
  normal degree
  </code></pre>
  
  <p>I must be setting the weights incorrectly, is it not sufficient to do <code>E(g)$weights &lt;- E(g)$V1</code> and why can <code>g$weights</code> differ from <code>E(g)$weights</code>?</p>