Skip to content
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

ENH: Graph.eliminate_zeros, refactor isolates #634

Merged
merged 3 commits into from
Nov 19, 2023

Conversation

martinfleis
Copy link
Member

Closes #633

# since not all zeros are necessarily isolates, do the focal == neighbor check
return nulls[nulls.index == nulls.neighbor].index.unique()
return (
nulls[nulls.index.codes[0] == nulls.index.codes[1]]
Copy link
Member Author

@martinfleis martinfleis Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed faster than the original solution. On exploded geoda tampa1 dataset and basic contiguity 84.8 µs ± 5.65 µs vs 253 µs ± 6.75 µs.

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #634 (afc14ab) into main (0b0bcba) will increase coverage by 0.0%.
Report is 17 commits behind head on main.
The diff coverage is 100.0%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #634   +/-   ##
=====================================
  Coverage   84.7%   84.8%           
=====================================
  Files        139     139           
  Lines      14869   14880   +11     
=====================================
+ Hits       12601   12612   +11     
  Misses      2268    2268           
Files Coverage Δ
libpysal/graph/base.py 97.7% <100.0%> (+<0.1%) ⬆️
libpysal/graph/tests/test_base.py 100.0% <100.0%> (ø)

libpysal/graph/base.py Outdated Show resolved Hide resolved
@martinfleis martinfleis merged commit c532954 into pysal:main Nov 19, 2023
10 checks passed
@martinfleis martinfleis deleted the zeros branch November 19, 2023 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

include a method to remove non-isolate zero-weight edges
3 participants