Application of Basic Graph Theory in Autonomous Motion of Robots