cleanup graph construction