Next Article in Journal
Does Land Use and Landscape Contribute to Self-Harm? A Sustainability Cities Framework
Previous Article in Journal
SocNav1: A Dataset to Benchmark and Learn Social Navigation Conventions
Open AccessTechnical Note

A Python Algorithm for Shortest-Path River Network Distance Calculations Considering River Flow Direction

1
Department of Geography, McGill University, Montreal, QC H3A 0B9, Canada
2
Graduate School of Economics, Hitotsubashi University, Tokyo 186-8601, Japan
3
Graduate School of Economics, University of Tokyo, Tokyo 113-0033, Japan
*
Author to whom correspondence should be addressed.
Received: 9 November 2019 / Revised: 4 December 2019 / Accepted: 11 January 2020 / Published: 16 January 2020
Vector based shortest path analysis in geographic information system (GIS) is well established for road networks. Even though these network algorithms can be applied to river layers, they do not generally consider the direction of flow. This paper presents a Python 3.7 program (upstream_downstream_shortests_path_dijkstra.py) that was specifically developed for river networks. It implements multiple single-source (one to one) weighted Dijkstra shortest path calculations, on a list of provided source and target nodes, and returns the route geometry, the total distance between each source and target node, and the total upstream and downstream distances for each shortest path. The end result is similar to what would be obtained by an “all-pairs” weighted Dijkstra shortest path algorithm. Contrary to an “all-pairs” Dijkstra, the algorithm only operates on the source and target nodes that were specified by the user and not on all of the nodes contained within the graph. For efficiency, only the upper distance matrix is returned (e.g., distance from node A to node B), while the lower distance matrix (e.g., distance from nodes B to A) is not. The program is intended to be used in a multiprocessor environment and relies on Python’s multiprocessing package. View Full-Text
Keywords: weighted Dijkstra; GIS; NetworkX; Amazonia weighted Dijkstra; GIS; NetworkX; Amazonia
Show Figures

Graphical abstract

  • Externally hosted supplementary file 1
    Doi: https://doi.org/10.6084/m9.figshare.10267415.v1
MDPI and ACS Style

Cadieux, N.; Kalacska, M.; Coomes, O.T.; Tanaka, M.; Takasaki, Y. A Python Algorithm for Shortest-Path River Network Distance Calculations Considering River Flow Direction. Data 2020, 5, 8.

Show more citation formats Show less citations formats
Note that from the first issue of 2016, MDPI journals use article numbers instead of page numbers. See further details here.

Article Access Map by Country/Region

1
Back to TopTop