Optimization cache by @yaoli - copy

Test copy without ipdb import. Used to run clean tests on Travis.
Are you sure this step make an independant graph.  There is some other function to make a copy of a graph called clone() if I remember correctly.