igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] going from a directed to an undirected graph


From: Tamas Nepusz
Subject: Re: [igraph] going from a directed to an undirected graph
Date: Sun, 9 Mar 2008 21:44:25 +0100

Dear Alisa,

My problem is that when I used the as.undirected function with the "collapse" parameter, I wiped out the secondary connection. Is there any way to replace each pair of directed edges with one undirected edge (i.e. not the "each" parameter) without removing multiple edges? Suggestions?
I assume you are using the R interface of igraph. Try utilizing the simplify() and count.multiple() calls. A possible solution is listed in the documentation:

E(g)$weight <- count.multiple(g)
g <- simplify(g)
E(g)$weight

simplify eliminates all multiple edges, so you'll have at most one edge from a->b or b->a. However, its associated weight attribute will contain the number of edges that were collapsed into this single edge.

--
T.




reply via email to

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