# Dijkstra algorithm

Page 1 of 1

## 3 Replies - 1362 Views - Last Post: 06 July 2013 - 01:24 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=324332&amp;s=406f20ce23fd750e8810e61f113f320f&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 rozkurwiator

Reputation: -1
• Posts: 147
• Joined: 03-July 12

# Dijkstra algorithm

Posted 06 July 2013 - 08:14 AM

Hi,
I am polish student and I am going to implement dijkstra's algorithm and I can't imagine that what is going on here
```decrease-key v in Q;
```

Could anybody explain what it means?Some easy explanation pleeease />/>
algorithm is here:

http://en.wikipedia....a%27s_algorithm

Sorry that I didn't use [CODE] tags. It is copied and it would look not friendly

This post has been edited by rozkurwiator: 06 July 2013 - 08:18 AM

Is This A Good Question/Topic? 0

## Replies To: Dijkstra algorithm

### #2 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 11449
• Posts: 43,165
• Joined: 27-December 08

## Re: Dijkstra algorithm

Posted 06 July 2013 - 11:37 AM

It's essentially a greedy breadth-first traversal of the graph. Start at A. All of the other nodes in the graph have an unknown (infinite) cost to reach. For each of A's edges, push them into a priority queue and update the distances for the adjacent vertices. Now, pick the edge with the lowest cost from the priority queue and repeat. Do this while the Priority Queue is not empty.

I have a tutorial you may find helpful as well, albeit it is in Java.

### #3 rozkurwiator

Reputation: -1
• Posts: 147
• Joined: 03-July 12

## Re: Dijkstra algorithm

Posted 06 July 2013 - 01:22 PM

Yes I understand almost all the algorithm but what to do with that:
```decrease-key v in Q;
```

Yes I understand almost all the algorithm but what to do with that:
```decrease-key v in Q;
```

Yes I understand almost all the algorithm but what to do with that:
```decrease-key v in Q;
```

### #4 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 11449
• Posts: 43,165
• Joined: 27-December 08

## Re: Dijkstra algorithm

Posted 06 July 2013 - 01:24 PM

Looking through the comments in the Wikipedia pseudo-code:

Quote

decrease-key v in Q; // Reorder v in the Queue

It looks like that section is associated with adding new edges to the Priority Queue.