igraph-help
[Top][All Lists]
Advanced

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

[igraph] Accessing/setting all vertex attributes at the same time


From: Florian Markowetz
Subject: [igraph] Accessing/setting all vertex attributes at the same time
Date: Tue, 7 Dec 2010 10:09:42 +0000

Hi igraph-list,

I am using the R interface to igraph.
R version 2.12.0 (2010-10-15)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
igraph_0.5.5

Now here is my problem: I'm having a graph and several attributes for each
vertex. I want to set and access all attributes at the same time, without
using a loop or an apply.

Here is a simple example. Imagine the following was my data (in reality my
graph has ~3000 nodes and each node has ~1000 attributes):

> g <- barabasi.game(10)
> vertexAnno <- data.frame(
    alias=LETTERS[1:10],
    domain=letters[1:10],
    value=rnorm(10)
    )

How do I set all vertex attributes in one go and avoid something like:
> for (i in colnames(vertexAnno)) g <-
set.vertex.attribute(g,i,value=vertexAnno[,i])

And once the attributes are set, how do I retrieve them again as one
dataframe? I don't want to loop over get.vertex.attribute().

Thanks a lot for your help!
Florian

PS: When I tried checking the email archives I only got to an
'unavailable'-page. So I apologize if this question got answered recently.

-- 
Florian Markowetz

Cancer Research UK 
Cambridge Research Institute
Li Ka Shing Centre
Robinson Way, Cambridge, CB2 0RE, UK

phone: +44 (0) 1223 40 4315
email: address@hidden
web  : http://www.markowetzlab.org
skype: florian.markowetz


This communication is from Cancer Research UK. Our website is at 
www.cancerresearchuk.org. We are a registered charity in England and Wales 
(1089464) and in Scotland (SC041666) and a company limited by guarantee 
registered in England and Wales under number 4325234. Our registered address is 
Angel Building, 407 St John Street, London, EC1V 4AD. Our central telephone 
number is 020 7242 0200.
 
This communication and any attachments contain information which is 
confidential and may also be privileged.   It is for the exclusive use of the 
intended recipient(s).  If you are not the intended recipient(s) please note 
that any form of disclosure, distribution, copying or use of this communication 
or the information in it or in any attachments is strictly prohibited and may 
be unlawful.  If you have received this communication in error, please notify 
the sender and delete the email and destroy any copies of it.
 
E-mail communications cannot be guaranteed to be secure or error free, as 
information could be intercepted, corrupted, amended, lost, destroyed, arrive 
late or incomplete, or contain viruses.  We do not accept liability for any 
such matters or their consequences.  Anyone who communicates with us by e-mail 
is taken to accept the risks in doing so.



reply via email to

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