Loop to print the distance of every node from source vertex
for ( int i = 0 ; i < dist . length ; i ++ ) { if ( dist [ i ] == infi ) { System . out . printf ( " % d ▁ and ▁ % d ▁ are ▁ not ▁ " + "connectedNEW_LINE", i, s); continue ; } System . out . printf ( " Distance ▁ of ▁ % dth ▁ vertex ▁ " + "from source vertex %d is: %dNEW_LINE", i, s, dist[i]); } } }