VeinsOfTheEarth / RivGraph

Extracting and quantifying graphical representations of river and delta channel networks from binary masks
https://veinsoftheearth.github.io/RivGraph/
Other
84 stars 26 forks source link

Resistance distance not correct #103

Open jonschwenk opened 2 months ago

jonschwenk commented 2 months ago

The resistance distance function has been found to produce incorrect values when compared against other implementations.

Immediate stopgap will be to print a warning when the function is run that its output should not be trusted.

jonschwenk commented 2 months ago

I can't recall specifics, but from what I can tell, the computation of the TopoDist variable (in Alex's original code) must have been done with a Matlab function for which there wasn't an exact replica that I could find in python. RivGraph's solution appears to have been a simple shortest path algorithm, but "shortest" refers only to the number of nodes along a path, without consideration for their actual lengths. Not 100% sure if this is the problem; trying to find Alex's original code.

jonschwenk commented 2 months ago

Code updated to print a warning statement when computing resistance distance. Once fixed we can release a new version so it's available in conda and pip RivGraph installations.