-
Notifications
You must be signed in to change notification settings - Fork 27
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
nb print method with large nb
objects crashes R
#160
Comments
I think it may be this part: |
https://github.com/r-spatial/spdep/blob/main/R%2Fsummary.nb.R#L65 was added to declare the subgraph count. This is done regularly in CARBayes and other downstream modelling packages because if the weights matrix is block diagonal, there could be multiple measures, one for each block. See also the end of https://r-spatial.org/book/14-Areal.html#contiguous-neighbours, where |
The implementation by Nicholas Lewin-Koh from 2001 uses Depth First Search; https://en.wikipedia.org/wiki/Depth-first_search gives its time complexity as order of node count plus edge count. The time complexity for In: , I added an
with |V| always 25357, but here |E| k=6: 183834, k=60: 1776536; k=600: 18267908. So the edge count is driving most of the time complexity. However, the |
Commit (including some other correction of |
I dropped the |
Brilliant thank you so much! I think this will be an improvement for users! |
Running reverse dependency checks now, should be OK, but I'll also contact packages maintainers using |
These use
The changes do not cause errors, but maybe they could use |
I'm unsure what specifically about the
nb
class print method is causing this, but I've noticed it previously and am encountering it again today.With somewhat large neighbor matrices, spdep will hang in computing for quite some time leading to RStudio reporting that R is not responding.
The text was updated successfully, but these errors were encountered: