Depth-First Paths

Enter three integers separated by spaces that give the number of vertices, number of edges, and a source vertex for a graph, respectively. A random graph with these parameters will be created and the tree of shortest paths back to the source vertex will be created in accordance with a depth-first traversal.