graph algorithms shortest-path algorithms in this section we examine various shortest-path problems the input is weighted graphassociated with each edge (vi vj is cost ci, to traverse the edge the cost of path vn is - = ci, + this is referred to as the weighted path length the unweighted path length is merely the number of edges on the pathnamelyn single-source shortest-path problem given as input weighted graphg (ve)and distinguished vertexsfind the shortest weighted path from to every other vertex in for examplein the graph in figure the shortest weighted path from to has cost of and goes from to to to the shortest unweighted path between these vertices is generallywhen it is not specified whether we are referring to weighted or an unweighted paththe path is weighted if the graph is notice also that in this graph there is no path from to the graph in the preceding example has no edges of negative cost the graph in figure shows the problems that negative edges can cause the path from to has figure directed graph - figure graph with negative-cost cycle