title: Igraph: export list vertices with vertex and edge attributes
body: <p>I have U.S. trade data between cities. I have attribute data on both the cities (nodes) and the trade (edges).</p>
  
  <p>Consider the following graph:</p>
  
  <pre><code>library(igraph)
  gg &lt;- graph.atlas(711)
  V(gg)$name &lt;- 1:7
  V(gg)$city &lt;- c("BOISE","NEW YORK","NEW YORK","BOISE","BOISE","LA","LA")
  V(gg)$color &lt;- ifelse(V(gg)$city=="BOISE", "orange","yellow")
  gg &lt;- delete.edges(gg, E(gg,P=c(1,2,2,3,2,7,7,6,7,3,3,4,3,5,4,5,5,6,6,1))) 
  gg &lt;- add.edges(gg,c(1,4,4,5,5,1),attr=list(trade=1))
  gg &lt;- add.edges(gg,c(7,5,5,4,4,7),attr=list(trade=2))
  gg &lt;- add.edges(gg,c(7,3,3,5,5,7),attr=list(trade=3))
  gg &lt;- add.edges(gg,c(2,7,7,6,6,2),attr=list(trade=4))
  gg &lt;- add.edges(gg,c(6,4),attr=list(trade=5))
  plot(gg, edge.label=E(gg)$trade)
  </code></pre>
  
  <p>The generates the following:</p>
  
  <p><a href="https://i.stack.imgur.com/YmHwj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YmHwj.png" alt="trade network"></a>
  </p>
  
  <p>From this, I want to export an edgelist that includes the edge attribute to a text file.</p>
  
  <p>For instance:</p>
  
  <pre><code>[CITY 1], [CITY 2], [TRADE]
  </code></pre>
  
  <p>Any help on how I can do this? It seems easy, but I am really stuck.</p>