Dijkstra: The Dijkstra algorithm.

Description Usage Arguments Examples

View source: R/Dijkstra.R

Description

This Dijkstra implementation solves the Shortest Path Problem (SPP), requiring an adjacency matrix and a source node to be supplied, creating an object of class Dijkstra with the solution stored within, this can the be accessed by printing the object or plotting it, for the raw solution data use the class method getPrev().

The graph class has the following class methods:

Usage

1

Arguments

adjMatrix

The ajacency matrix representing the graph to be solved, instead of a matrix the graph class can be supplied, and the adjacency matrix will be extracted.

sourceNode

The source node, corresponds to the node's row in the matrix supplied. Default is 1.

Examples

1
2
3
4
5
6
## Not run: 
  solution <- Dijkstra(matrix,1)
  print(solution)
  plot(solution)
  
## End(Not run)

robert-horne/SPAP documentation built on May 21, 2019, 10:09 a.m.