From a99813a993cae60470d8872ffbb291a02229f7bf Mon Sep 17 00:00:00 2001
From: Jesslyn Nathania <jesslynnathania99@gmail.com>
Date: Tue, 3 Mar 2020 01:08:53 +0700
Subject: [PATCH] fix error

---
 jb.txt         |  2 +-
 src/dijkstra.c | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/jb.txt b/jb.txt
index 30d0107..aeccc91 100644
--- a/jb.txt
+++ b/jb.txt
@@ -1,4 +1,4 @@
-0 0 0 0 0 0 0 0 0 0 
+0 11000 6740 527 11681 11896 4045 2091 9336 6705 
 11000 0 4330 10473 15111 9486 6955 8909 6926 4295 
 6740 4330 0 6213 10781 5156 2695 4649 2596 35 
 527 10473 6213 0 12208 11369 3518 1564 8809 6178 
diff --git a/src/dijkstra.c b/src/dijkstra.c
index 656c22a..08dec14 100644
--- a/src/dijkstra.c
+++ b/src/dijkstra.c
@@ -44,13 +44,19 @@ int main(int argc, char* argv[])
 		}
 		start=omp_get_wtime();
     
-    #pragma omp parallel num_threads(thread_count)
+    #pragma omp parallel num_threads(thread_count) private(distance)
     {
         distance = malloc(total_node *sizeof(int ));
 
         #pragma omp for
         for (int i =0; i<total_node; i++){
+
             dijkstra(graph, total_node,i, distance);
+            // printf("\nDistance of from node%d=",i);
+            // for(int i=0;i<total_node;i++){
+            //     printf("%d ", distance[i]);
+            // }
+            // printf("~~~~~~\n");
             for (int j=0; j<total_node; j++){
                 mat_res[i][j] = distance[j];
             }
@@ -70,7 +76,8 @@ int main(int argc, char* argv[])
 
 		//ending clock time
 		end=omp_get_wtime();
-		printf("\nThe algorithm took %f seconds to run with %d processes\n", end-start,thread_count);
+		printf("\nThe algorithm took %f seconds to run with %d processes\nNow seek for jb.txt in root folder\n", 
+        end-start,thread_count);
 	return 0;
 }
 
-- 
GitLab