0

How do I print out all the attributes for the nodes in my vertex sequence?

Given graph g, create an igraph vertex sequence with one vertex:

> (V(g)[1])
+ 1/12761 vertex, named:
[1] 18kPq7GPye-YQ3LyKyAZPw

Where 18kPq7GPye-YQ3LyKyAZPw is the vertex name. However, the vertices in the graph have other attributes as well:

> vertex_attr_names(g)
 [1] "name"  "realname"   "color"   "votes_funny"        

How do I print out all the attributes for the nodes in my vertex sequence?

ahoffer
  • 6,347
  • 4
  • 39
  • 68
  • `vertex.attributes(g)` maybe? Just a guess – Rich Scriven Oct 21 '15 at 19:03
  • It would be helpful to include a small [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample data. Are you just looking for `vertex_attr`? – MrFlick Oct 21 '15 at 19:04
  • Everybody wants a small reproducible example with sample data. The MIT guy always points people here: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Really, though I think this is straight-forward enough without the runnable sample. – ahoffer Oct 21 '15 at 19:43

1 Answers1

1

Ah snap! As soon as I posted the question, I found the answer:

> V(g)[[1]]
+ 1/12761 vertex, named:
                    name realname color yelping_since votes_funny votes_useful votes_cool review_count fans
1 18kPq7GPye-YQ3LyKyAZPw   Russel   red            NA         166          278        245   

Use double-brackets! [[ ]]

ahoffer
  • 6,347
  • 4
  • 39
  • 68