File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ this program is used to find minimum distance between two vertices while traversing all available vertices.
3+ */
14package javacodes ;
25
36import java .util .*;
@@ -49,7 +52,7 @@ void dijkstra(int graph[][], int src)
4952 }
5053
5154
52- dist [src ] = 0 ;
55+ dist [src ] = 0 ; /* Starting distance is zero */
5356
5457
5558 for (int count = 0 ; count < V -1 ; count ++)
@@ -83,7 +86,7 @@ public static void main (String[] args)
8386 {
8487 Scanner in =new Scanner (System .in );
8588
86- System .out .println ("Number of vertices:" );
89+ System .out .println ("Number of vertices:" ); /* print the total numbers of vertices */
8790
8891 V =in .nextInt ();
8992
@@ -97,7 +100,7 @@ public static void main (String[] args)
97100
98101 graph [i ][j ]=in .nextInt ();
99102 }
100- Dijkstra ob =new Dijkstra ();
103+ Dijkstra ob =new Dijkstra (); /* create new object of Dijkstra */
101104
102105 ob .dijkstra (graph , 0 );
103106 }
You can’t perform that action at this time.
0 commit comments