Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a directed graph with some negative edge weights ( but no negative cycles ) . A negative cycle is just a cycle where the

Consider a directed graph with some negative edge weights (but no negative cycles). A negative cycle is just a cycle where the sum total of the edge weights on the cycle is negative. (Shortest paths may not really make sense if there is a negative cycle (why?); this is why we impose this restriction). I want to find the shortest path from a vertex s to a vertex t of this graph. I come up with an idea to convert this problem into one solvable by Dijkstras algorithm. To do this, I find the most negative weight and add the same large enough value m to each and every edge weight of the graph, so that all the edge weights become positive. I now run Dijkstras algorithm on this graph with the modified edge weights and find a shortest path p from s to t in this modified graph. I claim that since all I did is add the same amount of weight to each edge, hence the same path p will be a shortest path from s to t in the original graph as well.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

978-0764535376

More Books

Students also viewed these Databases questions