kuanb / peartree

peartree: A library for converting transit data into a directed graph for sketch network analysis.
MIT License
201 stars 23 forks source link

On coalesce, only preserve the shortest edge #49

Closed kuanb closed 6 years ago

kuanb commented 6 years ago

On these lines: https://github.com/kuanb/peartree/blob/e37dbcb7031049e36e9213bd92780c3b4e1f05e8/peartree/toolkit.py#L201-L206

We should not be adding all edges. We should set it up so that there is only one edge in each direction for each node. In each case, if the existing edge is more costly, we should replace that edge, rather than append a new/different one to the same directional node pair.