jump to code

At the time of writing this, we’re currently under stay at home orders in observation of the Covid-19 pandemic. Taking those nice long walks around Manhattan at this time is ill-advised, but how about a digital one? In particular, here I’ll explore how to generate random walks within a map network.

What would happen if every time you walked up to an intersection you just turned in a random direction? Here’s one run of the simulation. Like real people, the random walk gets pretty lost in the dense streets of lower Manhattan. If you’re interested in generating one of these for yourself or just seeing the code, feel free to follow along with the jupyter notebook via my GitHub. Making this was so much easier with the amazing osmnx module, which allows you to grab map networks from OpenStreetMap.