I want to know how to merge overlapping edges when drawing an undirected graph with igraph.
Specifically, I want to display the two edges coming out from the nodes "2" and "3" together for the following figure that is displayed when the following code is executed.
At that time, I would like to make the thickness as many as the number of edges (in this case, 2) instead of just putting them together.
library ("igraph") g<-matrix (c ( 1,1,1,0, 1,2,2,1, 1,2,2,1, 0,1,1,1), nrow = 4, ncol = 4, byrow = TRUE) g<-graph.adjacency (g, mode = "undirected", diag = FALSE) plot (g)
When the following code was executed, it was possible to combine them into one, but it was not possible to make them as thick as the number of edges.
g<-simplify (g, remove.multiple = T)
We know that the edge thickness can be adjusted with edge.width when executing plot ().
plot (g, edge.width = value)
Thanks for your understanding.
Answer # 1
I was able to solve it by the following method. I apologize to you for a fuss over.
library (igraph) g<-graph_from_adjacency_matrix ( matrix (c ( 1,1,1,0, 1,2,2,1, 1,2,2,1, 0,1,1,1), nrow = 4, ncol = 4, byrow = TRUE), mode = "undirected", weighted = TRUE, diag = FALSE) ew<-abs (E (g) $weight) * 2 plot (g, edge.width = ew)
The points are as follows.
Use graph_from_adjacency_matrix () function.
Prepare "ew<-abs (E (g) $weight) * 2" to make the edge thickness the number of multiple sides.
Also, when outputting with plot (), describe with edge.width = ew.