-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: remove for loops from weighted dense matrix creation (#1483) #1518
base: main
Are you sure you want to change the base?
Conversation
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R/incidence.R
Outdated
el <- cbind(idx, incidence[idx]) | ||
|
||
el[, 2] <- el[, 2] + n1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is the same. I can refactor a bit and add comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
This PR removes (nested) for loops for dense weighted matrices. Specifically:
get.adjacency.dense
whenattr != NULL
graph.incidence.dense
whenweighted = TRUE
get.incidence.dense
whenattr != NULL