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

Shortest Path exercise clarification, 27.5.1. Exercise 1 #291

Open
klwlevy opened this issue Feb 23, 2024 · 1 comment
Open

Shortest Path exercise clarification, 27.5.1. Exercise 1 #291

klwlevy opened this issue Feb 23, 2024 · 1 comment

Comments

@klwlevy
Copy link

klwlevy commented Feb 23, 2024

When solving this exercise, it wasn't immediately clear to me that the graph must be directed. When allowing path traversal in both directions, for example allowing the path (27, 24) with cost 2.66 instead of just (24, 27), I found a shorter path from node 1 to node 100, namely this one with cost 117.61 instead of 160.55:

The shortest path from node 1 to 100 is 117.60999999999999 passing through the nodes [1, 2, 7, 10, 21, 25, 27, 24, 34, 42, 47, 45, 48, 51, 54, 57, 58, 61, 60, 72, 75, 82, 80, 86, 88, 89, 94, 95, 97, 98, 99, 100]

I changed the node numbers from 0:99 to 1:100 as I solved the exercise in Julia (Graphs.jl) with one-based indexing.

Maybe it is a good idea to clarify this in the exercise formulation, and maybe add the undirected case as an additional exercise?

@jlperla
Copy link
Member

jlperla commented Feb 23, 2024

Thanks so much, I will take a look!

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

No branches or pull requests

2 participants