Question

1- Can Dijkstra's algorithm handle negative edges cycles? Why/Why not? If not, is there any alternative...

1- Can Dijkstra's algorithm handle negative edges cycles? Why/Why not? If not, is there any alternative algorithms that can compute the shortest path for a graph with negative cycles?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

As per your requirement i have written solution which fulfill all your requirements please follow it step by step

No,Actually Dijkstra's algorithm cannot handle negative edges cycles.Let see that clearly

Recall that in Dijkstras algorithm, once a vertex is marked as closed (and out of the open set) - the algorithm found the

2 B--(-10)--〉C Vr(A, B,C) ; E {(A, C,2), (A, B,5), (B,C,-10)} Dijkstra from A will first develop C, and will later fail to fi

So for that We can find shortest path in graph that has negative weight cycles using Bellman–Ford Algorithm

Let see that clearly step by step through algorithm

Algorithnm Following are the detailed steps. Input: Graph and a source vertex src Output: Shortest distance to all vertices f

2) This step calculates shortest distances. Do following IVI-1 times where IVI is the number of vertices in given graph. ....

3) This step reports if there is a negative weight cycle in graph. Do following for each edge u-v .....If distivl]> dist[u] +

By this we have found solution for Can Dijkstra's algorithm handle negative edges cycles? Why/Why not? If not, is there any alternative algorithms that can compute the shortest path for a graph with negative cycles.

Add a comment
Know the answer?
Add Answer to:
1- Can Dijkstra's algorithm handle negative edges cycles? Why/Why not? If not, is there any alternative...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT