473,511 Members | 13,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dijkstra's Shortest Path Algorithm

Ganon11
3,652 Recognized Expert Specialist
Hey guys,

I'm back, and with another FUN question!

My latest homework asks this question:

"Suppose all the edge weights in a graph are integers between 1 and |E|. How fast can Dijkstra's algorithm be implemented?"

The only thing I could think of is somehow involving bucket sort - since the edges are bounded, we can use bucket sort to achieve an O(n) sorting time - but I'm not sure how I can use the sorted edge weights to help me at all. So I went to the book's reference section at the end of the chapter. There was a reference given that gave the solution to this problem, so I Googled it and came up with this big pdf file:

http://www.cs.umd.edu/~gasarch/651/dijcjacm.pdf

Basically, this is a portion of a textbook that involves the research done to develop a new data structure called a radix heap that can solve Dijkstra's algorithm in something like O(|E|log(|V|)/|E|log(log(|E|))) time.

I showed this to my T.A., who said there was no way I was expected to come up with this on my own, but hinted that there was some other way I could use bucket sort to improve the running time of DIjkstra's algorithm.

I have no clue of how to do this, so I;d like some guidance if possible.

Note: My class is in C++, but since I don't need to do any coding for this, only understand a concept, I posted in Misc. Discussions. A non-code specific suggestion or hint would be greatly appreciated.

Thanks a lot, guys! I'll continue working here on my end.

Also, the homework is due tomorrow. Haste is also appreciated :D
Nov 14 '07 #1
1 5108
Ganon11
3,652 Recognized Expert Specialist
EDIT: wow. Literally 30 seconds after I posted this, I realized something:

At each step in the algorithm, with unbounded edge weights, at least |V|log(|V|) (using a priority queue for fast deleteMin operations). But if the edge weights are bounded, we can sort with Bucket Sort in O(|V|) time and pick the first (smallest) element in O(1) time, which is slightly faster than |V|log(|V|) time.

If anyone else has brilliant suggestions, I'd love to hear them - but crisis averted!
Nov 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
5870
by: ThanhVu Nguyen | last post by:
Hi all, I need recommendation for a very fast shortest path algorithm. The edges are all directed, positive weights. Dijkstra shortest path will solve it just fine but the if the graph is not...
3
6224
by: A_StClaire_ | last post by:
implemented Dijkstra's algorithm as follows. plz pour on the negative criticism cuz I know I have a ton to learn. oh, before you flame me regarding the language, my class was told to do this in...
3
5004
by: Ook | last post by:
This is probably a bit OT, as I'm not looking for a c++ implementaiton of Dijkstra's algorithm, rather I'm just trying to understand it (is there a better place then here to ask this question?)....
1
16109
by: arlef | last post by:
Can somebody please explain and provide pseudocode for the Dijkstra algorithm? I'm trying to implement the Dijkstra shortest path algorithm. However, I'm finding it extremely difficult to...
2
3094
by: Bytter | last post by:
Hi everyone, I need to implement a very quick (performance-wise) Dijkstra shortest path in python, and found that libboost already has such thing. Problem is: I cannot find the installation...
8
4106
by: abhradwip | last post by:
I want to write a program which will find the shortest path between n no. of cities using dijkstra's algorithm ...... but could not do it..... i have written a program which will give the shortest...
2
4198
by: Gurpreet Singh | last post by:
Hello everyone can anybody give me the c-code of dijkstra algorithm which is a method of finding the shortest path in a graph
2
4637
by: shashankbs | last post by:
Given a topology and a certain node X, find the shortest path tree with X as the root. * Input: a topology file similar to the following (which is a three-node ring) ...
1
14188
by: Glenton | last post by:
Hi All Here is a very simple little class for finding a shortest route on a network, following Dijkstra's Algorithm: #!/usr/bin/env python #This is meant to solve a maze with Dijkstra's...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.