pysal / spopt

Spatial Optimization
https://pysal.org/spopt/
BSD 3-Clause "New" or "Revised" License
301 stars 46 forks source link

an error with the maxp code #63

Closed Yongyi-Liu closed 4 years ago

Yongyi-Liu commented 4 years ago

https://github.com/pysal/spopt/blob/b6676446209d1f176f4456e03b83ba9c86fa61fa/spopt/region/maxp.py#L220

The if condition is always false here, the label could never be assigned -1

rwei5 commented 4 years ago

There could be islands with no neighbors

Sent from my iPhone

On Aug 18, 2020, at 3:52 PM, Yongyi-Liu notifications@github.com wrote:



https://github.com/pysal/spopt/blob/b6676446209d1f176f4456e03b83ba9c86fa61fa/spopt/region/maxp.py#L220

The if condition is always false here, the label could never be assigned -1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pysal/spopt/issues/63, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABX5XRY6PW7VQ7QAAJCWLBTSBMAZFANCNFSM4QEHQOEQ .

Yongyi-Liu commented 4 years ago

I see the condition for island. But the condition should be len(NeighborPolys) == 0 instead of len(NeighborPolys) <0 because the length of the neighborhood list cannot be negative

jGaboardi commented 4 years ago

resolved with #64