[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] as.undirected() strips vertex attributes?
From: |
uxzmdlj02 |
Subject: |
[igraph] as.undirected() strips vertex attributes? |
Date: |
Fri, 21 Sep 2007 14:08:48 -0500 |
It looks like as.undirected() strips vertex attributes in igraph
0.4.3. Is this a bug?
Example:
> list.vertex.attributes(g)
[1] "id"
> list.vertex.attributes(as.undirected(g))
character(0)
Any easy workaround?
For now I'll just use:
as.undirected2 <- function(g){
## store the attributes:
tempAtt <- list()
for(a in list.vertex.attributes(g)){
tempAtt <- c(tempAtt,list(get.vertex.attribute(g,a)))
names(tempAtt)[length(tempAtt)] <- a
}
## convert the graph:
res <- as.undirected(g)
## restore the attributes:
for(a in names(tempAtt)){
set.vertex.attribute(g,a,value=tempAtt[[a]])
}
}
Will this work? Is this actually a bug?
Thanks,
Peter
- [igraph] key players in networks, Simone Gabbriellini, 2007/09/11
- Re: [igraph] key players in networks, Gabor Csardi, 2007/09/13
- Re: [igraph] key players in networks, Gabor Csardi, 2007/09/13
- Re: [igraph] key players in networks, Simone Gabbriellini, 2007/09/16
- Re: [igraph] key players in networks, Simone Gabbriellini, 2007/09/19
- Re: [igraph] key players in networks, Tamas Nepusz, 2007/09/19
- Re: [igraph] key players in networks, Gabor Csardi, 2007/09/20
- [igraph] as.undirected() strips vertex attributes?,
uxzmdlj02 <=
- Re: [igraph] as.undirected() strips vertex attributes?, Tamas Nepusz, 2007/09/21
- Re: [igraph] as.undirected() strips vertex attributes?, uxzmdlj02, 2007/09/21
- Re: [igraph] as.undirected() strips vertex attributes?, Gabor Csardi, 2007/09/24
- Re: [igraph] as.undirected() strips vertex attributes?, Tamas Nepusz, 2007/09/24