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
<[email protected]> 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
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to