Learn R Programming

ionet (version 0.2.2)

dijkstra: Dijkstra's algorithm

Description

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)

Value

A list of distance and previous node.

Arguments

adjmat

The adjacency matrix of a directed, weighted network.

src

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

References

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