Description Usage Arguments Value References Examples
This function uses dijkstra algorithms to find the shortest distance between two nodes in a graph. Starting from the init_node,the algorithm creates two sets for invisited nodes and visited nodes.To every node,set zero to init_node and infinity to other nodes. For the current node,calculate the distance to its neighbors and compare with the known distances,assign the shortest.Once after finding the shortest distance to a node,divide the node into visited set and set a new init_node.Reverse the step until all nodes are visited.
1 | dijkstra(graph, init_node)
|
graph |
A data.frame. |
init_node |
A number. |
the shortest path to every other node from the starting node as a vector.
https://en.wikipedia.org/wiki/Dijkstra
1 2 | dijkstra(wiki_graph,3)
dijkstra(wiki_graph,1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.