Defined primitive path finding algorithm