Added a function to check the visited node array and see if a given space has been visited