You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The internal functions get.adjacency.dense() and get.adjacency.sparse() return different results for weighted multigraphs. get.adjacency.sparse() aggregates weights for multi edges and get.adjacency.dense() reports the weight of the last edge. In my opinion, the behavior of get.adjacency.sparse() is correct. The PR #1518 coincidentally fixes this.
Given this is indeed a bug, then the following test should be fixed either in a new PR or the existing PR #1518 (see also the discussion there)
Yes, the weights should be added up. Thanks for catching this!
IMO the best solution here is to call the C core, which is not happening now. Relying on the C core ensures consistency and reduces code duplication.
The C core does not support Boolean adjacency matrices, so it is to be decided what to do with that. Options are to implement this in R, or to convert logical values to numeric, then convert back again. It's also a question whether logicals should be supported. One argument in favour is that it's not too difficult to do so.
So what's your take on PR #1518?
Does it make sense to merge optimised R code or should this be replaced entirely by calls to the C core (when possible)?
@szhorvat friendly reminder about @schochastics' question above. Is the conversion of sparse matrices from C to R and vice versa still a blocker for this?
What happens, and what did you expect instead?
The internal functions
get.adjacency.dense()
andget.adjacency.sparse()
return different results for weighted multigraphs.get.adjacency.sparse()
aggregates weights for multi edges andget.adjacency.dense()
reports the weight of the last edge. In my opinion, the behavior ofget.adjacency.sparse()
is correct. The PR #1518 coincidentally fixes this.Given this is indeed a bug, then the following test should be fixed either in a new PR or the existing PR #1518 (see also the discussion there)
rigraph/tests/testthat/test-conversion.R
Lines 175 to 183 in 0d96334
To reproduce
igraph 2.0.3
Created on 2024-10-10 with reprex v2.1.1
System information
No response
The text was updated successfully, but these errors were encountered: