graph construction