graph fixed, df flow changed for efficiency