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