pysal / spaghetti

SPAtial GrapHs: nETworks, Topology, & Inference
http://pysal.org/spaghetti/
BSD 3-Clause "New" or "Revised" License
260 stars 69 forks source link

Can you calculate a distance matrix between point patterns without calculating all vertex distance pairs? #725

Open iboates opened 1 year ago

iboates commented 1 year ago

I am struggling with some performance issues when calling Network. allneighbordistances between my source and destination point patterns.

When I looked into the code, it seems to me that the first thing this method does is calculate all the vertex distance pairs in the entire network with Network.full_distance_matrix

Is there a way to only compute the network distances between the source and destination point patterns without computing all vertex pair distances? Maybe I am not getting it but it seems wasteful to do all vertex pairs first when I already know the distances of every line feature from the geodataframe from which I initialized the network.

For reference I am using spaghetti in tandem with spopt to optimize the placement of facilities, mostly by following (but modifying) this tutorial: https://pysal.org/spopt/notebooks/mclp.html

jGaboardi commented 1 year ago

No, this is not currently possible due to the historic structure of pysal.network (spaghetti's predecessor) and the utilization of the djikstra algorithm). There has been discussion^1 for overhauling & modernizing spaghetti for some years now, but there has been little action due to time constraints. And as usual, since this is an OS project maintained in our free time contributions are always welcome!