title: how to specify the labels of vertices in R
body: <p>I have an matrix as below:</p>
  
  <pre><code>          jerry    peter    king
   jerry     1       0        0    
   peter     0       1        0    
   king      1       1        1              
  </code></pre>
  
  <p>Now I am trying to draw a graph standing for the matrix with the code below:</p>
  
  <pre><code>t &lt;- read.table("../data/table.dat");
  adjm &lt;- data.matrix(t);
  g1 &lt;- graph.adjacency(adjm,add.colnames=NULL);
  plot(g1, main="social network", vertex.color="white", edge.color="grey", vertex.size=8,
       vertex.frame.color="yellow");
  </code></pre>
  
  <p>The labels of the vertices is the id, so my question is how do I set the label of the vertices by the dimnames of the matrix?</p>
  
  <p>I have tried to the code</p>
  
  <pre><code>vertex.label=attr(adjm,"dimnames")
  </code></pre>
  
  <p>but get the wrong graph.</p>