title: Vertex Labels in igraph R
body: <p>I am using igraph to plot a non directed force network.</p>
  
  <p>I have a dataframe of <code>nodes</code> and <code>links</code> as follows:</p>
  
  <pre><code>&gt; links
    source target  value sourceID targetID
  1      3      4 0.6245  1450552  1519842
  2      6      8 0.5723  2607133  3051992
  3      9      7 0.7150  3101536  3025831
  4      0      1 0.7695   401517   425784
  5      2      5 0.5535  1045501  2258363
  
  &gt; nodes
        name group size
  1   401517     1    8
  2   425784     1    8
  3  1045501     1    8
  4  1450552     1    8
  5  1519842     1    8
  6  2258363     1    8
  7  2607133     1    8
  8  3025831     1    8
  9  3051992     1    8
  10 3101536     1    8
  </code></pre>
  
  <p>I plot these using <code>igraph</code> as follows:</p>
  
  <pre><code>gg &lt;- graph.data.frame(links,directed=FALSE)
  plot(gg, vertex.color = 'lightblue', edge.label=links$value, vertex.size=1, edge.color="darkgreen", 
       vertex.label.font=1, edge.label.font =1, edge.label.cex = 1, 
       vertex.label.cex = 2 )
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/sN8I5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sN8I5.png" alt="enter image description here"></a></p>
  
  <p>On this plot, igraph has used the proxy indexes for <code>source</code> and <code>target</code> as vertex labels.</p>
  
  <p>I want to use the real ID's, in my <code>links</code> table expressed as <code>sourceID</code> and <code>targetID</code>.</p>
  
  <p>So, for:</p>
  
  <pre><code>  source target  value sourceID targetID
  1      3      4 0.6245  1450552  1519842
  </code></pre>
  
  <p>This would show as:</p>
  
  <pre><code>(1450552) ----- 0.6245 ----- (1519842)
  </code></pre>
  
  <p>Instead of:</p>
  
  <pre><code>      (3) ----- 0.6245 ----- (4)
  </code></pre>
  
  <p>(Note that the proxy indexes are zero indexed in the <code>links</code> dataframe, and one indexed in the <code>nodes</code> dataframe. This offset by 1 is necessary for <code>igraph</code> plotting).</p>
  
  <p>I know I need to somehow <code>match</code> or <code>map</code> the proxy indexes to their corresponding <code>name</code> within the <code>nodes</code> dataframe. However, I am at a loss as I do no not know the order in which igraph plots labels.</p>
  
  <p>How can I achieve this?</p>
  
  <p>I have consulted the following questions to no avail:</p>
  
  <p><a href="https://stackoverflow.com/questions/21335944/vertex-labels-in-igraph-with-r">Vertex Labels in igraph with R</a>
  <a href="https://stackoverflow.com/questions/8352227/how-to-specify-the-labels-of-vertices-in-r">how to specify the labels of vertices in R</a>
  <a href="https://stackoverflow.com/questions/17433402/r-igraph-rename-vertices">R igraph rename vertices</a></p>