undirected graph from adjacency matrix without symmetric matrix
The docs say the following when mode is "undirected" (and weighted =TRUE):
First we check that the matrix is symmetric. It is an error if not. Then only the upper triangle is used to create a weighted undirected graph.
But the following code (adapted from the example) runs just fine:
adjm <- matrix(runif(100), 10)
adjm[ adjm<0.5 ] <- 0
graph_from_adjacency_matrix(adjm, weighted=TRUE, mode="undirected")
The example does force a symmetric matrix through (adjm + t(adjm))/2. When looking at the documentation the function graph.adjacency.sparse has a check for symmetry but the function graph.adjacency.dense does not.
Obviously nothing is lost as in with or without a symmetric matrix the result is the same. The question is whether this is intentional and if the docs need to be updated.
The code is wrong, graph.adjacency.dense should check for symmetry.
Thx, I'll create a pull request (unless you've already changed it)
PR is welcome! Thanks!
Okay, I have a patch for this now but I'll hold it off until 1.3.2 is out because this can potentially break reverse dependencies if they happened to use a non-symmetric weighted adjacency matrix (and I don't feel like waiting another 1.5 days to re-run all revdep checks now).
I believe we handle this better in igraph 1.6.0 and in the current mainline. Do we need to take further action?