Closed romainFr closed 4 years ago
yep, thank you so much @romainFr, you were indeed right in being confused there. It was a bug that i had fixed in all other flow aggregation routines, but not flows_disperse
. The above commit fixes and now gives the following (with k=10
just to yield higher values to ease visual comparison):
library(dodgr)
graph1 <- data.frame(from=c("a","a","d","d"),
to=c("b","c","a","b"),
d=c(5,6,3,2))
dodgr_flows_disperse(graph1,from="d",k=10,dens=1)
#> from to d flow
#> 1 a b 5 0.0000000
#> 2 a c 6 0.2067880
#> 3 d a 3 0.3767922
#> 4 d b 2 0.4164198
graph2 <- data.frame(from=c("d","d","a","a"),
to=c("a","b","b","c"),
d=c(3,2,5,6))
dodgr_flows_disperse(graph2,from="d",k=10,dens=1)
#> from to d flow
#> 1 d a 3 0.3767922
#> 2 d b 2 0.4164198
#> 3 a b 5 0.0000000
#> 4 a c 6 0.2067880
Created on 2020-08-27 by the reprex package (v0.3.0)
(And there is no flow dispersed from a
to b
, because d->b
is the shortest path there, so all flow from d
to b
disperses along that path only.)
I'll add this bug fix to news straight away and ping you there. Thanks for helping to improve the package!
I'm probably misunderstanding what the function is supposed to do, but I was perplexed by results when running it on a very minimal example, say:
My first incomprehension is why the flow is not dispersed to the edges coming from
a
. Then comes the even more perplexing bit:With the exact same graph (the only difference is the order of the edges in the data frame), I get a different result. Am I doing something absurd (I'm guessing I am)? And thanks for the package, btw!