Skip to content

dequeue for PriorityQueue should return Key-Value Pair not just Key #845

Closed

Description

@micampbell

Generally, the dequeue operation is to retrieve the value in a path-planning tree search. As currently implemented, one needs to call peek() to get to the "best" value (best is lowest or highest depending on direction), followed by dequeue!() to remove it. This is cumbersome and inefficient (two calls to get "best").
make dequeue! return the same as peek

Activity

  1. hdavid16 commented on Apr 27, 2023

    @hdavid16

    There is dequeue_pair! to do this. However, I do agree that it makes sense to just have dequeue! do this.

  2. micampbell commented on Apr 27, 2023

    @micampbell
    Author

    I didn't know of dequeue_pair!. That solves it, but this semantic choice is antithetical to all other programming languages.

  3. hdavid16 commented on Apr 27, 2023

    @hdavid16

    I totally agree with you! I would recommend keeping this issue open since this syntax is not ideal for users.

  4. micampbell commented on Apr 27, 2023

    @micampbell
    Author

    well, if you think it isn't too late to change....re-opened

  5. hdavid16 commented on Apr 28, 2023

    @hdavid16

    It looks like #479 removes these and replaces them with popfirst!, which behaves as dequeue_pair!. This is to conform with Julia base.

  6. aoanla commented on Dec 17, 2023

    @aoanla
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions