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

Search algorithms for graphs #30

Open
rabestro opened this issue Jan 10, 2022 · 1 comment
Open

Search algorithms for graphs #30

rabestro opened this issue Jan 10, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@rabestro
Copy link
Owner

rabestro commented Jan 10, 2022

Story

As a user, I would like to find the shortest and the fastest routes in the graph. For the shortest path, the Bread First Search algorithm should be used. For the fastest path, we should use Dijkstra's algorithm.

Example

Given

a complex graph with eight nodes

Graph Schema

Vertex Edges
A [B:5, H:2]
B [A:5, C:7]
C [B:7, D:3, G:4]
D [C: 20, E: 4]
E [F: 5]
F [G: 6]
G [C: 4]
H [G: 3]

When

we use the Breadth-First Search algorithm for the first route.
and
we use Dijkstra's algorithm for the second route.

Then

the first route is the shortest
and
the second route is the fastest

Where

The results for this graph are presented in the table

source target time shortest time fastest
A A 0 [A] 0 [A]
B B 0 [B] 0 [B]
A B 5 [A, B] 5 [A, B]
B A 5 [B, A] 5 [B, A]
A C 12 [A, B, C] 9 [A, H, G, C]
C A 12 [C, B, A] 12 [C, B, A]
A G 5 [A, H, G] 5 [A, H, G]
C D 3 [C, D] 3 [C, D]
D C 20 [D, C] 19 [D, E, F, G, C]
B D 10 [B, C, D] 10 [B, C, D]
D B 27 [D, C, B] 26 [D, E, F, G, C, B]
D H 34 [D, C, B, A, H] 33 [D, E, F, G, C, B, A, H]
@rabestro rabestro self-assigned this Jan 10, 2022
@rabestro rabestro added the enhancement New feature or request label Jan 10, 2022
@rabestro rabestro changed the title Test Search algorithms for graphs Jan 10, 2022
@rabestro rabestro pinned this issue Jan 11, 2022
@rabestro
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant