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

Graph : paths between vertices #11

Open
epatrizio opened this issue Jan 28, 2022 · 1 comment
Open

Graph : paths between vertices #11

epatrizio opened this issue Jan 28, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@epatrizio
Copy link
Owner

In graph_exists_path function, we determine if there is a path between 2 vertices.
-> in algorithm implementation we use a hash set to remember visited vertices.
But, by this method, it's impossible to know the path, we only know if it exists!

So, to know paths between vertices, we need to modify the algorithm and use a hash map (instead of a hash set) to remember visited vertices and origin vertices.

@epatrizio epatrizio added the enhancement New feature or request label Jan 28, 2022
@epatrizio
Copy link
Owner Author

  • graph_dfs_exists_path: use a hash_map (key=target vertex / value=source vertex)
  • graph_bfs_exists_path: from a vertex source, vertex are visited withan increasing distance. Use a hash_map (key=source vertex / value=integer) to determine the distance

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