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

[coalesce] Use mean of grouped edge weights rather than minimum #127

Closed yiyange closed 5 years ago

yiyange commented 5 years ago

Using minimum of grouped edge weights effectively reduce path costs, and increase accessibility significantly. The following map shows shortest path lengths from one single source to all destinations in Berkeley. It changes from using original full network to coalesced network using min grouped edge weights. Noticing the shortest path lengths reduce significantly (darker color to lighter color) use_min

The following map shows the same change but using coalesced network using mean (different color bins though). The change is less significant. use_mean

Also some stats comparison:

Stats Full Network Coalesced w Min Coalesced w Mean
Max shortest path length 5172 3092 3493
Mean shortest path length 2488 1383 1619

Visuals made by UrbanFootprint :))

kuanb commented 5 years ago

Excellent observation - thank you!!

This also helps in working towards addressing various risks associated with this issue: https://github.com/kuanb/peartree/issues/126

kuanb commented 5 years ago

TODO:

yiyange commented 5 years ago

@kuanb i updated the logic and reran, the impact is much less unfortunately. but it is a start.

kuanb commented 5 years ago

@yiyange Update on this PR: I just updated tests, tweaked logic. Should be passing the Travis tests shortly and will merge in after that - thanks again.

codecov[bot] commented 5 years ago

Codecov Report

Merging #127 into master will increase coverage by 0.24%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #127      +/-   ##
==========================================
+ Coverage   91.43%   91.68%   +0.24%     
==========================================
  Files          13       13              
  Lines        1109     1106       -3     
==========================================
  Hits         1014     1014              
+ Misses         95       92       -3
Impacted Files Coverage Δ
peartree/toolkit.py 93.5% <100%> (+1.19%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 761910a...09a5732. Read the comment docs.