Hi, 
So I've been figuring out how to use igraph in R and like it for it's speed
and simplicity. Now I have a graph built from an edgelist where vectors have
a $name attribute.  I have another dataframe with attributes tied to a
vector ID, which is the same as the $name attribute of vectors represented
in the graph.  

How can I iterate over the graph by V(g)$name and do set.vector.attributes
for the other attributes in the vector dataframe?  Of course, the edgelist
for the graph contains each vector zero or many times and they are not
sorted in the same order as the vector dataframe.  It's a large bit of data:
about 20m edges and 3m vectors. I can't do this by hand.

Perhaps the answer is something like,
by V(g)[]$name in g  {
  i=get.index(V(g)$name)
  if (V(g)[1]$name == dataframe$ID)  {
     V(g)[1]$newattribute1 <- dataframe$attribute1
     V(g)[1]$newattribute2 <- dataframe$attribute2
     V(g)[1]$newattribute3 <- dataframe$attribute3
   }
}

 R,
CW Dillon


--
View this message in context: 
http://r.789695.n4.nabble.com/Add-attributes-to-igraph-vector-by-name-not-index-tp4580032p4580032.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to