Better passing of graph in multiprocessing