made working edge getting code using graph