0

I am converting a directed graph into an undirected graph using as.undirected. However, there is an issue with the attributes combination, specifically in the first line and first column.

Here is how it looks like as a directed graph (net) :

net <- graph.data.frame(edges, nodes, directed=T) as.matrix(get.adjacency(net, attr = "weight"))

matrix

Then...

netSym <- as.undirected(net, "collapse", edge.attr.comb="sum") as.matrix(get.adjacency(netSym, attr = "weight"))

matrix with attributes combined, and the inexplicable error

Basically, everything is correct, except for the combination of OL and OM. It should be 10 and not 11.

Has anyone encountered the same issue? Would anyone know of a way around?

Thank you!

  • Please do not provide your data as an image. It means that if we want to try to work with your example, we have to type it all in. Instead, please use `dput` to provide a text version of your data that we can cut and paste into R. – G5W Jul 12 '17 at 18:00
  • Actually, it seems to me that when you use "collapse", you should not get either 10 or 11 for OL-OM, rather you should get 1. mode="each" should give 10. – G5W Jul 12 '17 at 18:14
  • Thank you for your help. I will provide a text version next time! As for the the "collapse" function with "sum" mode, it sums the edge attributes. Since 0L->0M = 5 and 0M->0L = 5, it should be 10. At least it is how it works for the rest of the matrix. The error always appear in the same position of the matrix... – MaximeF Jul 26 '17 at 09:55

0 Answers0