Let us create the graph shown in above diagram
graph = [ [ 0 , 10 , 3 , 2 ] , [ INF , 0 , INF , 7 ] , [ INF , INF , 0 , 6 ] , [ INF , INF , INF , 0 ] ] NEW_LINE u = 0 NEW_LINE v = 3 NEW_LINE k = 2 NEW_LINE print ( " Weight ▁ of ▁ the ▁ shortest ▁ path ▁ is " , shortestPath ( graph , u , v , k ) ) NEW_LINE