Optimize DependencyGraph#clone

Profiling with very large graphs revealed that the existing clone method
takes about half of the total solution time (use of threads for Timeout
obscures the profiling data somewhat). This implementation of clone
performs much better.