partial work using graphs