From 6500e7b9a975f5f51aba2a476595b4408285ab94 Mon Sep 17 00:00:00 2001 From: Akhil Baiju <45595599+akhilbaiju@users.noreply.github.com> Date: Sun, 31 Oct 2021 17:28:22 +0530 Subject: [PATCH] =?UTF-8?q?Dijkstra=E2=80=99s=20Algorithm=20in=20C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dijkstra algorithm is also called single source shortest path algorithm. It is based on greedy technique. The algorithm maintains a list visited[ ] of vertices, whose shortest distance from the source is already known. --- Dijkstra Algorithm.c | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Dijkstra Algorithm.c diff --git a/Dijkstra Algorithm.c b/Dijkstra Algorithm.c new file mode 100644 index 00000000..81298d36 --- /dev/null +++ b/Dijkstra Algorithm.c @@ -0,0 +1,82 @@ +#include +#include +#define INFINITY 9999 +#define MAX 10 + +void dijkstra(int G[MAX][MAX],int n,int startnode); + +int main() +{ +int G[MAX][MAX],i,j,n,u; +printf("Enter no. of vertices:"); +scanf("%d",&n); +printf("\nEnter the adjacency matrix:\n"); +for(i=0;i