generatGraph modified