From: "Frédéric van der Plancke" <fvdp@decis.be>
To: "caml-list@inria.fr >> caml-list" <caml-list@inria.fr>
Subject: Re: [Caml-list] Priority queues
Date: Fri, 01 Jul 2011 10:51:53 +0000 [thread overview]
Message-ID: <4E0DA6C9.2020208@decis.be> (raw)
In-Reply-To: <4E0DA252.1060105@gmail.com>
On 1/07/2011 10:32, Andrew wrote:
> Jean-Christophe Filliâtre wrote:
>>
>>> Are we talking about Dijkstra's graph traversal algorithm?
>>> If so, there is no need to increase/decrease anything.
>>
>> Implementing Dijkstra's shortest path algorithm actually requires to
>> decrease the priority of some nodes. But this does not mean your
>> priority queue data structure has to support such an operation.
>>
>> When you consider the edge x->y, x being the node you just extracted
>> from the priority queue, you might just have discovered a better path to
>> y and thus you have to update the priority associated to x. When there
>> is indeed such an improvement, you have two options:
>>
>> - either your priority queue data structure provides a decrease_key
>> operation, and then you use it; this is the case with Fibonacci heaps,
>> an imperative data structures which provides decrease_key in O(1) and
>> thus makes Dijkstra's algorithm complexity O(V log(V) + E).
>>
>> - or your priority queue does not provide such an operation, and you
>> simply add another entry for y in the priority queue, with a different
>> key. It means you have now several entries for y in the priority queue.
>> The better will be extracted first; the others will be ignored when they
>> are extracted later. Complexity is now O(E log(V)).
>
> Just an extra question though: How come it's not O(E log (E))? You
> could end up pushing as much as one new element in your heap per edge,
> couldn't you?
>
log(E) is O(log(V)), since log(E) <= 2 * log(V)...
Frédéric
next prev parent reply other threads:[~2011-07-01 10:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 11:30 Andrew
2011-06-30 11:40 ` Török Edwin
2011-06-30 11:56 ` Andrew
2011-06-30 12:13 ` Wojciech Meyer
2011-06-30 12:34 ` Andrew
2011-06-30 12:43 ` Wojciech Meyer
2011-06-30 17:29 ` Christophe Raffalli
2011-06-30 17:45 ` Christophe Raffalli
2011-06-30 12:28 ` Guillaume Yziquel
2011-06-30 12:33 ` Jean-Christophe Filliâtre
2011-06-30 13:19 ` Michael Ekstrand
2011-06-30 14:07 ` Alexandre Pilkiewicz
2011-06-30 14:20 ` Michael Ekstrand
2011-06-30 14:22 ` David Rajchenbach-Teller
2011-06-30 14:29 ` Wojciech Meyer
2011-06-30 17:11 ` Andrew
2011-06-30 22:51 ` Wojciech Meyer
2011-07-01 5:06 ` Andrew
2011-06-30 16:06 ` Jean-Christophe Filliâtre
2011-07-01 10:32 ` Andrew
2011-07-01 10:51 ` Frédéric van der Plancke [this message]
[not found] <fa.zXwbS6BNVmuh5Yg3lR+NAiHb7b8@ifi.uio.no>
2011-07-01 22:37 ` Radu Grigore
2011-07-02 20:54 ` Brian Hurt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E0DA6C9.2020208@decis.be \
--to=fvdp@decis.be \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox