Skip to content

Main example for priority queue using dijkstra's algorithm.#15857

Merged
bors merged 1 commit into
rust-lang:masterfrom
treeman:doc-dijkstra-example
Jul 22, 2014
Merged

Main example for priority queue using dijkstra's algorithm.#15857
bors merged 1 commit into
rust-lang:masterfrom
treeman:doc-dijkstra-example

Conversation

@treeman

@treeman treeman commented Jul 21, 2014

Copy link
Copy Markdown
Contributor

I wanted to have a slightly larger example compared to the method examples, but I'm unsure how it worked out.

Feedback would nice.

Comment thread src/libcollections/priority_queue.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bikeshed alert: wonder if this shouldn't be a full position instead. It's not that much longer.

@steveklabnik

Copy link
Copy Markdown
Contributor

I really like this idea.

@treeman

treeman commented Jul 22, 2014

Copy link
Copy Markdown
Contributor Author

Great! Thanks for the pointers.

Comment thread src/libcollections/priority_queue.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be

loop {
    let State { position, cost } = match pq.pop() {
        None => break, // empty
        Some(s) => s
    };

    // ...
}

@alexcrichton

Copy link
Copy Markdown
Member

This is a fantastic example, nice job!

This looks good to go with two minor comments and some squashings, thanks!

@treeman

treeman commented Jul 22, 2014

Copy link
Copy Markdown
Contributor Author

Cool, thanks!

bors added a commit that referenced this pull request Jul 22, 2014
I wanted to have a slightly larger example compared to the method examples, but I'm unsure how it worked out.

Feedback would nice.
@bors bors closed this Jul 22, 2014
@bors bors merged commit 94500b8 into rust-lang:master Jul 22, 2014
@treeman treeman deleted the doc-dijkstra-example branch September 17, 2014 09:50
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2023
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants