Jump to content

Need Help at Dijkstra's Algorithm!

Featured Replies

Hi!!! I need some help at the following exercise...

Let G=(V,E) be a directed graph, where V={a,b,c,d,e}, E={(a,b),(a,e),(b,c),(c,d),(d,e),(e,c)} and their weights 1,2,2,-1,-1,3 respectively. Show where the Dijkstra's algorithm fails.


What I've done so far is:

At the beginning the distances are d[a]=0, d=d[c]=d[d]=d[e]=infinity

a gets extracted first, after the edges (a,b) and (a,e) are relaxed, and the distances are d=1, d[e]=2.

b is extracted next, after the edge (b,c) is relaxed, and d[c]=3

then c is extracted,after the edge (c,d) is relaxed and d[d]=2


At this step I have difficulties... Now d[d]=d[e]... How do I continue??

  • Author

Sorry, but what I did the exercise is not correct, so I did it again and found that:

At the beginning the distances are d[a]=0, d=d[c]=d[d]=d[e]=infinity
a gets extracted first, after the edges (a,b) and (a,e) are relaxed, and the distances are d=1, d[e]=2.
b is extracted next, after the edge (b,c) is relaxed, and d[c]=3
then e is extracted,after the edge (e,c) is relaxed, and d[c]=3
then c is extracted,after the edge (c,d) is relaxed, and d[d]=2
finally d is extracted,after the edge (d,e) is relaxed, and d[e]=1
How can I show that Dijkstra's Algorithm fails??

Edited by mathmari

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.