igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] faster way to add attributes to nodes


From: Simone Gabbriellini
Subject: [igraph] faster way to add attributes to nodes
Date: Sat, 16 Feb 2013 15:58:13 +0100

Hello List,

I have to attach node attributes which I have stored in a matrix like:

id       posts   threads   zindex
"u32"  "123"   "12"        "0.45"

is there anything faster than this:

for(mm in V(gTorgo)[which(V(gTorgo)$type==FALSE)]$name){
        list<-torgoValues[which(torgoValues[,1]==mm),]
        V(gTorgo)[which(V(gTorgo)$name==mm)]$post<-as.numeric(list[2])
        V(gTorgo)[which(V(gTorgo)$name==mm)]$thread<-as.numeric(list[3])
        V(gTorgo)[which(V(gTorgo)$name==mm)]$zindex<-as.numeric(list[4])
}

my code is particularly slow on big networks... thanks!

Best,
Simone

-- 
Simone Gabbriellini, PhD

address@hidden, University of Bologna
mobile: +39 340 39 75 626
email: address@hidden
home: www.digitaldust.it

DigitalBrains srl
Amministratore
mobile: +39 340 39 75 626
email: address@hidden
home: www.digitalbrains.it



reply via email to

[Prev in Thread] Current Thread [Next in Thread]