Skip to contents

Implement the Dijkstra's algorithm to find the shortest paths from the source node to all nodes in the given network.

Usage

dijkstra(adjmat, src)

Arguments

adjmat

The adjacency matrix of a directed, weighted network.

src

An integer specifying the given source node to find the shortest distance.

Value

A list of distance and previous node.

References

Dijkstra, E. W. (1959). A Note on Two Problems in Connexion with Graphs. Numerische Mathematik, 1, 269--271.