igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Regarding combining weights of undirected inverted edges


From: Tamas Nepusz
Subject: Re: [igraph] Regarding combining weights of undirected inverted edges
Date: Fri, 3 Jun 2016 09:47:26 +0200

Hi,

as.undirected() has an argument named edge.attr.comb that tells igraph
what to do with edge attributes when multiple edges are collapsed into
a single one:

> as.undirected(g, edge.attr.comb=list(weight="mean"))

T.


On Fri, Jun 3, 2016 at 3:17 AM, Anurag Passi
<address@hidden> wrote:
> Hello,
>
> I am new to igraph and I have a rather trivial query. I have a data in the
> format:
>
> Source Target Weight
> A         B        0.1
> B         A        0.3
> A         B        0.4
>
> I want to combine these rows so that I have one edge (undirected) between A
> and B and the Weight is the AVERAGE of the weights of the edges between A
> and B and only one edge representing the connection between A and B.
> Something like:
>
> Source Target Weight
> A          B      (0.1+0.4+0.3)/3
>
> I have used aggregate(), as.undirected() functions but nothing seems to work
> as the Weights tend to get lost during conversion from table to graph.
>
> Please help.
>
> Regards,
> Anurag
>
> --
> Anurag Passi
> Sr. Research Fellow
> OSDD, CSIR
> 00-91-9899767938
> skype: anurag.passi
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



reply via email to

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