dijkstra: Dijkstra algorithm for finding shortest paths between source...

Description Usage Arguments Value Source

View source: R/Dijks.R

Description

The algorithm checks for indices of minimum distance and updates the distance value of its neighbours only if there exists a path from source to current node such that path distance is less than current distance value.

Usage

1
dijkstra(graph, init_node)

Arguments

graph

A graph represented in the form of data frame with 3 columns namely v1,v2,w which represents starting node values,ending node values,weight of the path.

init_node

A source node in the form of scalar from which shortest distance to every node is calculated.

Value

A vector containing shortest distance from source node to all other nodes.

Source

https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm.


venkatavarun-123/R_LAB3 documentation built on Dec. 23, 2021, 3:02 p.m.