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.
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
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.