Let us create the graph shown in above diagram
int [ , ] graph = new int [ , ] { { 0 , 10 , 3 , 2 } , { INF , 0 , INF , 7 } , { INF , INF , 0 , 6 } , { INF , INF , INF , 0 } } ; GFG t = new GFG ( ) ; int u = 0 , v = 3 , k = 2 ; Console . WriteLine ( " Weight ▁ of ▁ the ▁ shortest ▁ path ▁ is ▁ " + t . shortestPath ( graph , u , v , k ) ) ; } }