graph edge fix and working a algo