In cases where there are several different shortest paths between two nodes (and edges have varying length),the most convenient of these paths is often the one with fewest edges. Forinstance, if nodes represent cities and edge lengths represent costs of flying between cities, theremight be many ways to get from cityto city t which all have the same cost. The mostconvenientof these alternatives is the one which involves the fewest stopovers. Accordingly, for a specific starting node S , define
minimum number of edges in a shortest path from S to u .
In the example below, thebestvalues for nodes are , respectively.

Give an efficient algorithm for the following problem.
Input:Graph ; positive edge lengths ; starting node .
Output: The values of should be set for all nodes