ahoffer
ahoffer

Reputation: 6546

igraph print vertex attributes R

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?

Upvotes: 0

Views: 376

Answers (1)

ahoffer
ahoffer

Reputation: 6546

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! [[ ]]

Upvotes: 1

Related Questions