Moved graph code to eliminate mpsim dependence