clean up graph construction
clean up graph construction