igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] as.undirected() strips vertex attributes?


From: Gabor Csardi
Subject: Re: [igraph] as.undirected() strips vertex attributes?
Date: Mon, 24 Sep 2007 12:13:13 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

The reason for dropping the attributes is that it is not obvious 
to implement the case when multiple edges are mapped to one edge. 
There should be a flexible solution for this, like passing a function 
to be called on the attributes of the edges to calculate the new attribute,
but it is not straightforward to do it from the R, Python, etc. interfaces.

But i guess we can implement it for the obvious cases, and give 
and warning about attributes getting dropped when it is not possible 
to do it with this naive implementation.

Tamas, permute_edges was added for this to the attribute handling 
table, i guess we'll need a permute_vertices function too sooner or 
later. Then the delete_edges and delete_vertices entries are actually
not needed. Just in case you want to implement this.

As for the cohesive blocking code and igraph releases. There will be 
a release before the end of September, we need some changes for the 
new 2.6 R version, but that might be a minor release only. 
Thanks for your report and also for the contribution!

Gabor

On Fri, Sep 21, 2007 at 07:39:23PM -0500, address@hidden wrote:
> Ok, thanks for the response.
> 
> By the way, any idea of timeframe for the 0.5 release? I have some R  
> code for cohesive blocking (as in Moody, While 2003) that I was  
> planning to hand over to the project, and maybe before a point  
> release would be the best time...
> 
> Oh, and in case anybody else uses it, my function from the last email  
> should be:
> 
> 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(res,a,value=tempAtt[[a]])
>     }
>     return(res)
> }
> 
> 
> 
> On Sep 21, 2007, at 3:00 PM, Tamas Nepusz ntamas-at-rmki.kfki.hu | 
> igraph-help| wrote:
> 
> >>It looks like as.undirected() strips vertex attributes in igraph
> >>0.4.3. Is this a bug?
> >Yes, unfortunately that's a bug - thanks for reporting it. It will be
> >fixed in igraph 0.5 (I already added an entry in our issue tracker).
> >The workaround you implemented seems okay to me, but since the cause
> >of this issue is in the low-level C layer of the library, it will be
> >fixed there (so we don't have to work out a workaround for every
> >single higher level interface).
> >
> >-- 
> >Tamas
> >
> >
> >_______________________________________________
> >igraph-help mailing list
> >address@hidden
> >http://lists.nongnu.org/mailman/listinfo/igraph-help
> 
> 
> 
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

-- 
Csardi Gabor <address@hidden>    MTA RMKI, ELTE TTK




reply via email to

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