Question: I need help writing a function on C++, void map::mapToGraph(graph &g){...} to create a graph g that represents the legal moves in the map m.
I need help writing a function on C++, void map::mapToGraph(graph &g){...} to create a graph g that represents the legal moves in the map m. Each vertex should represent a cell, and each edge should represent a legal move between adjacent cells. map m is a text file called 'map1.txt'
and what it contains inside the text file is the following:

The traveler starts at the island located at latitude = 0 and longitude = 0 (i.e., (0,0)) in the upper left corner, and the goal is to drive to the island located at (MaxLattitude-1, MaxLongitudes-1) in the lower right corner. A legal move from an island is to move left, right, up, or down to an immediately adjacent cell that has road connectivity which means a cell that contains "0". Moving off any edge of the map is not allowed. This should be done using an adjacency matrix
map1 - Notepad File Edit Format View Help 11 10 OXXXXXXXXX 00000000XX OXOXOXOXXX OXOXOX0000 XXOXXXOXXX X0000000XX XXXXXXXOOOZ map1 - Notepad File Edit Format View Help 11 10 OXXXXXXXXX 00000000XX OXOXOXOXXX OXOXOX0000 XXOXXXOXXX X0000000XX XXXXXXXOOOZ
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
