Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pathfinding part 1 #3069

Merged
merged 3 commits into from
May 20, 2024
Merged

pathfinding part 1 #3069

merged 3 commits into from
May 20, 2024

Conversation

jyoung4242
Copy link
Contributor

blog entry for pathfinding part 1

Copy link

cloudflare-pages bot commented May 19, 2024

Deploying excaliburjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 32ddae6
Status: ✅  Deploy successful!
Preview URL: https://e2fb3d18.excaliburjs.pages.dev
Branch Preview URL: https://pathfindingblog.excaliburjs.pages.dev

View logs


### Dijkstra's Algorithm

Dijkstra's Algorithm is an algorithm for finding the shortest path through a graph that presents weighting (distances) between
Copy link
Member

Choose a reason for hiding this comment

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

Small nit, algorithm is used twice in the sentence


![Graph Network](./img/image-2.png)

Edsger Dijkstra, in Amsterdam, was sipping coffee at a cafe in Amserdam in 1956, and was working through a mental exercise regarding
Copy link
Member

Choose a reason for hiding this comment

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

Small nit, Amsterdam is used twice in the sentence

Let's declare A our starting node and update our results object with this current information. Since we are starting at node A, we then
review A's connected neighbors, in this example its nodes B and C.

![alt text](./img/image-3.png)
Copy link
Member

Choose a reason for hiding this comment

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

Add alt text


With that update, we can move node A from unvisited to visited list, and we have this new state.

![alt text](./img/image-4.png)
Copy link
Member

Choose a reason for hiding this comment

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

Add alt text


We continue to repeat this algorithm until we have visited all nodes.

Quick iteration:
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what Quick Iteration means

In this article, we reviewed a brief history of Dijkstra's Algorithm, then we created and example graph network and stepped through it
using the algorithm, and then was able to use it to determine the shortest path of nodes.

This algorithm I have found is more expensive than A\*, but is a nice tool to use when you don't understand the shape and size of the
Copy link
Member

Choose a reason for hiding this comment

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

It might be nice to have this benefit at the beginning of the article as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the only one that i waffled on regarding making a change...

sometimes, I need just to understand if that path is clear between one tile and another. Sometimes you can have a graph node tree, and
need to understand the cheapest decision. These are the kinds of challenges where one could use a pathfinding algorithm to solve.

![alt text](./img/image-1.png)
Copy link
Member

Choose a reason for hiding this comment

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

Add alt ext


Node B is closer to Source than node D, so we visit it next.

![alt text](./img/image-6.png)
Copy link
Member

Choose a reason for hiding this comment

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

Add alt text


D is the only unvisited neighbor, and we hit a dead end on this branch, so D gets visited, but with no updates to the results table

![alt text](./img/image-7.png)
Copy link
Member

Choose a reason for hiding this comment

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

Add alt text

@eonarheim eonarheim merged commit 863e998 into main May 20, 2024
7 of 8 checks passed
@eonarheim eonarheim deleted the pathfindingblog branch May 20, 2024 04:46
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.

None yet

2 participants