Assuming I have a working dijkstra's shortest path method, how can I use this to determine whether or not a directed graph is strongly connected or not?
-
1Are these homework questions? They read very much like they are; please take a look at the [homework meta SE guidance](http://meta.stackexchange.com/a/10812/201031) and edit your question to show your attempts or progress. – Jeff Bowman May 20 '16 at 02:15
-
1You should be asking this question on http://cs.stackexchange.com/ – smac89 May 20 '16 at 02:17
1 Answers
Why does a shortest path algorithm say that all nodes are reachable from the input node?
What shortest path algorithm are you talking about?
Is there such a thing as s shortest path in a strongly connected directed graph?
As long as a graph is connected, it contains a shortest path. Different algorithms like bfs, dijkstra's, Belman ford, etc, all exist to find shortest paths in graphs with unique properties
Why if you reverse the graph will all nodes still be reachable?
This is only true if the graph is strongly connected. Also this is just one of the many ways to determine if a graph is strongly connected. Another way is to run dfs from each node and as long as every node is touched each time until the last node, the graph is strongly connected.
How does this prove that the graph is strongly connected?
I don't know the proof by heart, but a proof exists and you can find it from Google.
Is there any place where I can find code to determine if a graph is strongly connected using a shortest path algorithm?
To determine is a graph is strongly connected, first run dfs through the graph. If all the nodes are reachable, reverse the direction of the edges and run dfs again, if all the nodes are still reachable, the graph is strongly connected
How would I have to code this using a shortest path algorithm myself?
Look up dfs on Google

- 39,374
- 15
- 132
- 179