From 3164aed7f46491a22484f8f675b604d4ec73bb8d Mon Sep 17 00:00:00 2001 From: Abdurrezzak Efe Date: Tue, 14 Nov 2017 21:33:36 +0200 Subject: [PATCH] Add files via upload --- 23.DijkstraAlgorithm.cpp | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 23.DijkstraAlgorithm.cpp diff --git a/23.DijkstraAlgorithm.cpp b/23.DijkstraAlgorithm.cpp new file mode 100644 index 0000000..ed09597 --- /dev/null +++ b/23.DijkstraAlgorithm.cpp @@ -0,0 +1,67 @@ +/* + * This program constructs a graph from user inputs and + * finds shortest path distances to everynode from node 0 using + * Dijkstra's Shortest Path algorithm + * + * Coded by: Abdurrezak Efe + * */ + +#include +using namespace std; + +const int V = 1000; //assumed number of vertices +int edges[V+1][V+1] = {0}; //the graph itself + +int minDistanceIndex(int distance[], bool inPath[], int v) +{ + int minDist = 999999999, minIndex=-1; + + for(int i=0; i> v >> e; + + //constructing the graph + int x,y,w; + for(int i=0;i> x >> y >> w, edges[x][y] = edges[y][x] = w; + + Dijkstra(v, e); +} \ No newline at end of file