implementet function to detect cycles from starting vertex
added some comments about the cycle detection and removal