refactor: remove for loops from weighted dense matrix creation (#1483)#1518
refactor: remove for loops from weighted dense matrix creation (#1483)#1518schochastics wants to merge 7 commits intoigraph:mainfrom
Conversation
Current Aviator status
This PR is currently in state
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
|
Thank you!! I'll start by adding some tests (from examples) for |
| el <- cbind(idx, incidence[idx]) | ||
|
|
||
| el[, 2] <- el[, 2] + n1 |
There was a problem hiding this comment.
Is this the same as
el <- cbind(idx, incidence[idx] + n1)?
In either case, this needs a bit of explanation in a comment.
There was a problem hiding this comment.
Yes that is the same. I can refactor a bit and add comments
There was a problem hiding this comment.
sorry I was wrong here. It is not the same, which makes it obvious that comments are needed...
|
The tests are erroring, is it the tests' or the code's fault? 😅 |
|
I will have a look! |
|
cc @maelle rigraph/tests/testthat/test-conversion.R Lines 175 to 183 in 0d96334 Here is an error in the test. The test graph has multiple edges and the edge weights are aggregated. E.g. the entry [3,3] is supposed to be 5.6+6.0=11.6 and not 6.0 and [4,2] is 6.1+ 3.3+4.3=13.7 and not 4.3. The aggregation makes sense and is invoked by The later snapshot errors seem to be related with this error (I am not familiar with |
|
Thank you! It'd make sense to fix them in another PR to main to check they're passing for main, then we'll merge and rebase this PR. At least I think it makes sense 😅 |
|
hmm they currently pass on main, so in the current igraph version, |
|
then either open a PR (and we'd cherry-pick the commit into this branch here) or an issue for discussion? Thanks so much. |
12c9a27 to
a1799e3
Compare
|
closing this and splitting it into three separate PRs |
This PR removes (nested) for loops for dense weighted matrices. Specifically:
get.adjacency.densewhenattr != NULLgraph.incidence.densewhenweighted = TRUEget.incidence.densewhenattr != NULL