dijkstra: Implement Dijkstras algorithm.

Description Usage Arguments Value Examples

View source: R/dijkstra.R

Description

The algorithm takes a graph and an initial node and calculates the shortest path from the initial node to every other node in the graph.

Usage

1
dijkstra(graph, init_node)

Arguments

graph

A data.frame with three variables (v1, v2 and w) that contains the edges of the graph (from v1 to v2) with the weight of the edge (w).

init_node

A numeric scalar that exist in the graph.

Value

The shortest path to every other node from the starting node as a vector.

Examples

1
2
3

shihs/LiUAdRLab3 documentation built on May 6, 2019, 8:32 p.m.