SlideShare a Scribd company logo
1 of 3
Download to read offline
I JUST NEED THE GRAPH.H FILE PLEASE
In this project, you will develop algorithms that find road routes through the bridges to travel
between islands.
The input is a text file containing data about the given map. Each file begins with the number of
rows and columns in the map considered as maximum latitudes and maximum longitudes
respectively on the map. The character "X" in the file represents the water that means if a cell
contains "X" then the traveler is not allowed to occupy that cell as this car is not drivable on water.
The character "0" in the file represents the road connected island. That means if a cell contains "0"
then the traveler is allowed to occupy that cell as this car can drive on roads.
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.
Input: The map files
Output: Print paths as explicitly specified for all the functions in Part A
You should have single main function that calls all the required functions for Part A for all the 3
given input map files one by one.
Please use the graph.h
Part A
Consider the following class map,
class map
{
public:
map(ifstream &fin);
void print(int,int,int,int);
bool isLegal(int i, int j);
void setMap(int i, int j, int n);
int getMap(int i, int j) const;
int getReverseMapI(int n) const;
int getReverseMapJ(int n) const;
void mapToGraph(graph &g);
bool findPathRecursive(graph &g, stack<int> &moves);
bool findPathNonRecursive1(graph &g, stack<int> &moves);
bool findPathNonRecursive2(graph &g, queue<int> &moves);
bool findShortestPath1(graph &g, stack<int> &bestMoves);
bool findShortestPath2(graph &, vector<int> &bestMoves);
void map::printPath(stack<int> &s);
int numRows(){return rows;};
int numCols(){return cols;};
private:
int rows; // number of latitudes/rows in the map
int cols; // number of longitudes/columns in the map
matrix<bool> value;
matrix<int> mapping; // Mapping from latitude and longitude co-ordinates (i,j) values to node index
values
vector<int> reverseMapI; // Mapping from node index values to map latitude i value
vector<int> reverseMapJ; // Mapping from node index values to map longitude j value
};
1. Using the above class map, write function 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.
2. Write a recursive function findPathRecursive(graph &g, stack<int> &moves) that looks for a path
from the start island to the destination island. If a path from the start to the destination exists, your
function should call the map::printPath() function that should print a sequence of correct moves
(Go left, Go right, Go down, Go up, etc.). If no path from the start to the destination exists, the
program should print, "No path exists". If a solution exists the solver should also simulate the
solution to each map by calling the map::print() function. The map::print() function prints out a map
visualization, with the goal and current position of the car in the map at each move, marked to
show the progress. Hint: consider recursive-DFS.
3. Write a function findPathNonRecursive1(graph &g, stack<int> &moves) that does the same
thing as in 2, but by using stack and without using recursion. If a path from the start to the
destination exists, your function should call the map::printPath() function that should print a
sequence of correct moves (Go left, Go right, Go down, Go up, etc.). If no path from the start to
the destination exists, the program should print, "No path exists". If a solution exists the solver
should also simulate the solution to each map by calling the map::print() function. The map::print()
function prints out a map visualization, with the goal and current position of the car in the map at
each move, marked to show the progress. Hint: consider stack-based DFS.
4. Write a function findPathNonRecursive2(graph &g, queue<int> &moves) that does the same
thing as in 2, but by using queue and without using recursion. If a path from the start to the
destination exists, your function should call the map::printPath() function that should print a
sequence of correct moves (Go left, Go right, Go down, Go up, etc.). If no path from the start to
the destination exists, the program should print, "No path exists". If a solution exists the solver
should also simulate the solution to each map by calling the map::print() function. The map::print()
function prints out a map visualization, with the goal and current position of the car in the map at
each move, marked to show the progress. Hint: consider queue-based BFS.
The code you submit should apply all three findPath functions to each map, one after the other.
The map input files named map1.txt, map2.txt, and map3.txt can be downloaded from the canvas.
Example of a map input file:
7
10
Start - 0XXXXXXXXX
00000000XX
0X0X0X0XXX
0X0X0X0000
XX0XXX0XXX
X0000000XX
XXXXXXX000Z - Destination
Thus, You should submit a single zip folder within which you need to have 4 files including, 1) a
single ".cpp" code file that includes all the above-required functions called from a single main
function, 2) a single ".h" header file, 3) README file with the compile and execution instructions,
and 4) your pre-compiled ".exe" executable file. On top of your .cpp code file, .h header file, and
README file, you need to mention your name as comments. You may have an additional PDF file
if you want to narrate your additional observations about running the functions of this project, e.g.,
drawing the graph to compare the runtime and explain the results. All submitted code files must be
named as "<your-name>.cpp". For example, it will be "jankibhimani.cpp", "jankibhimani_graph.h",
and "jankibhimani.exe". The zip folder containing all the files should be named as "<your-
name>_code.zip". For example, it will be "jankibhimani_code.zip". Please follow the Guidelines for
Software Engineering Techniques.pdf and Assignments and Project Style and Documentation
Guidelines.pdf made available to you in your Student Resources module for other document
editing and code format guidelines.
Some header files you may need are following, that can be found in you header files zip folder
available to you to download on Canvas.
#include <iostream>
#include <limits.h>
#include "d_except.h"
#include <list>
#include <fstream>
#include "d_matrix.h"
#include <queue>
#include <vector>

More Related Content

Similar to I JUST NEED THE GRAPHH FILE PLEASE In this project yo.pdf

Write a program that reads a graph from a file and determines whether.docx
 Write a program that reads a graph from a file and determines whether.docx Write a program that reads a graph from a file and determines whether.docx
Write a program that reads a graph from a file and determines whether.docxajoy21
 
05 Geographic scripting in uDig - halfway between user and developer
05 Geographic scripting in uDig - halfway between user and developer05 Geographic scripting in uDig - halfway between user and developer
05 Geographic scripting in uDig - halfway between user and developerAndrea Antonello
 
TSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) DropboxTSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) DropboxSeb Sear
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxEleanor McHugh
 
Big data shim
Big data shimBig data shim
Big data shimtistrue
 
AI Lab menu for ptu students and easy to use and best quality and help for 6t...
AI Lab menu for ptu students and easy to use and best quality and help for 6t...AI Lab menu for ptu students and easy to use and best quality and help for 6t...
AI Lab menu for ptu students and easy to use and best quality and help for 6t...Sonu880062
 
CountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdfCountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdfAggarwalelectronic18
 
Im having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdfIm having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdfrishteygallery
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in cgkgaur1987
 
IntroductionTopological sorting is a common operation performed .docx
IntroductionTopological sorting is a common operation performed .docxIntroductionTopological sorting is a common operation performed .docx
IntroductionTopological sorting is a common operation performed .docxmariuse18nolet
 
The Functional Programming Triad of Map, Filter and Fold
The Functional Programming Triad of Map, Filter and FoldThe Functional Programming Triad of Map, Filter and Fold
The Functional Programming Triad of Map, Filter and FoldPhilip Schwarz
 
Opensource gis development - part 3
Opensource gis development - part 3Opensource gis development - part 3
Opensource gis development - part 3Andrea Antonello
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacksmaamir farooq
 
Create swath profiles in GRASS GIS
Create swath profiles in GRASS GISCreate swath profiles in GRASS GIS
Create swath profiles in GRASS GISSkyler Sorsby
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptxGuy Komari
 
FilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docx
FilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docxFilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docx
FilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docxmydrynan
 
Application of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdfApplication of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdfNancy Ideker
 

Similar to I JUST NEED THE GRAPHH FILE PLEASE In this project yo.pdf (20)

Write a program that reads a graph from a file and determines whether.docx
 Write a program that reads a graph from a file and determines whether.docx Write a program that reads a graph from a file and determines whether.docx
Write a program that reads a graph from a file and determines whether.docx
 
05 Geographic scripting in uDig - halfway between user and developer
05 Geographic scripting in uDig - halfway between user and developer05 Geographic scripting in uDig - halfway between user and developer
05 Geographic scripting in uDig - halfway between user and developer
 
TSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) DropboxTSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) Dropbox
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
 
Big data shim
Big data shimBig data shim
Big data shim
 
AI Lab menu for ptu students and easy to use and best quality and help for 6t...
AI Lab menu for ptu students and easy to use and best quality and help for 6t...AI Lab menu for ptu students and easy to use and best quality and help for 6t...
AI Lab menu for ptu students and easy to use and best quality and help for 6t...
 
CountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdfCountryData.cppEDIT THIS ONE#include fstream #include str.pdf
CountryData.cppEDIT THIS ONE#include fstream #include str.pdf
 
Im having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdfIm having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdf
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 
Pointer
PointerPointer
Pointer
 
IntroductionTopological sorting is a common operation performed .docx
IntroductionTopological sorting is a common operation performed .docxIntroductionTopological sorting is a common operation performed .docx
IntroductionTopological sorting is a common operation performed .docx
 
The Functional Programming Triad of Map, Filter and Fold
The Functional Programming Triad of Map, Filter and FoldThe Functional Programming Triad of Map, Filter and Fold
The Functional Programming Triad of Map, Filter and Fold
 
Opensource gis development - part 3
Opensource gis development - part 3Opensource gis development - part 3
Opensource gis development - part 3
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
Create swath profiles in GRASS GIS
Create swath profiles in GRASS GISCreate swath profiles in GRASS GIS
Create swath profiles in GRASS GIS
 
purrr.pdf
purrr.pdfpurrr.pdf
purrr.pdf
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
FilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docx
FilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docxFilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docx
FilesAssignm3.h#ifndef Assignm3_H#define Assignm3_H.docx
 
Application of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdfApplication of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdf
 

More from sukhvir71

HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfHW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfsukhvir71
 
httpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfhttpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfsukhvir71
 
Human impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfHuman impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfsukhvir71
 
HR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfHR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfsukhvir71
 
Humans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfHumans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfsukhvir71
 
i A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfi A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfsukhvir71
 
HuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfHuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfsukhvir71
 
humans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfhumans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfsukhvir71
 
Hunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfsukhvir71
 
I need full assignment with every steps Write a program tha.pdf
I need full assignment  with every steps Write a program tha.pdfI need full assignment  with every steps Write a program tha.pdf
I need full assignment with every steps Write a program tha.pdfsukhvir71
 
I need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfI need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfsukhvir71
 
I need an explanation for the wrong and the correct answer .pdf
I need an explanation for the wrong and the correct answer  .pdfI need an explanation for the wrong and the correct answer  .pdf
I need an explanation for the wrong and the correct answer .pdfsukhvir71
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfsukhvir71
 
I need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfI need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfsukhvir71
 
I need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfsukhvir71
 
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfHxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfsukhvir71
 
I measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfI measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfsukhvir71
 
I need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdfI need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdfsukhvir71
 
How would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfHow would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfsukhvir71
 
i Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfi Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfsukhvir71
 

More from sukhvir71 (20)

HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfHW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
 
httpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfhttpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdf
 
Human impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfHuman impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdf
 
HR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfHR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdf
 
Humans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfHumans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdf
 
i A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfi A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdf
 
HuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfHuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdf
 
humans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfhumans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdf
 
Hunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdf
 
I need full assignment with every steps Write a program tha.pdf
I need full assignment  with every steps Write a program tha.pdfI need full assignment  with every steps Write a program tha.pdf
I need full assignment with every steps Write a program tha.pdf
 
I need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfI need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdf
 
I need an explanation for the wrong and the correct answer .pdf
I need an explanation for the wrong and the correct answer  .pdfI need an explanation for the wrong and the correct answer  .pdf
I need an explanation for the wrong and the correct answer .pdf
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdf
 
I need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfI need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdf
 
I need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdf
 
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfHxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
 
I measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfI measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdf
 
I need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdfI need a Full Runnable code and UML Diagram for the followin.pdf
I need a Full Runnable code and UML Diagram for the followin.pdf
 
How would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfHow would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdf
 
i Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfi Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdf
 

Recently uploaded

UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17Celine George
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxMohamed Rizk Khodair
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...Nguyen Thanh Tu Collection
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...Krashi Coaching
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the lifeNitinDeodare
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya - UEM Kolkata Quiz Club
 
Software testing for project report .pdf
Software testing for project report .pdfSoftware testing for project report .pdf
Software testing for project report .pdfKamal Acharya
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticspragatimahajan3
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptxmanishaJyala2
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatmentsaipooja36
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfMinawBelay
 

Recently uploaded (20)

UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
Software testing for project report .pdf
Software testing for project report .pdfSoftware testing for project report .pdf
Software testing for project report .pdf
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
 

I JUST NEED THE GRAPHH FILE PLEASE In this project yo.pdf

  • 1. I JUST NEED THE GRAPH.H FILE PLEASE In this project, you will develop algorithms that find road routes through the bridges to travel between islands. The input is a text file containing data about the given map. Each file begins with the number of rows and columns in the map considered as maximum latitudes and maximum longitudes respectively on the map. The character "X" in the file represents the water that means if a cell contains "X" then the traveler is not allowed to occupy that cell as this car is not drivable on water. The character "0" in the file represents the road connected island. That means if a cell contains "0" then the traveler is allowed to occupy that cell as this car can drive on roads. 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. Input: The map files Output: Print paths as explicitly specified for all the functions in Part A You should have single main function that calls all the required functions for Part A for all the 3 given input map files one by one. Please use the graph.h Part A Consider the following class map, class map { public: map(ifstream &fin); void print(int,int,int,int); bool isLegal(int i, int j); void setMap(int i, int j, int n); int getMap(int i, int j) const; int getReverseMapI(int n) const; int getReverseMapJ(int n) const; void mapToGraph(graph &g); bool findPathRecursive(graph &g, stack<int> &moves); bool findPathNonRecursive1(graph &g, stack<int> &moves); bool findPathNonRecursive2(graph &g, queue<int> &moves); bool findShortestPath1(graph &g, stack<int> &bestMoves); bool findShortestPath2(graph &, vector<int> &bestMoves); void map::printPath(stack<int> &s); int numRows(){return rows;}; int numCols(){return cols;}; private: int rows; // number of latitudes/rows in the map
  • 2. int cols; // number of longitudes/columns in the map matrix<bool> value; matrix<int> mapping; // Mapping from latitude and longitude co-ordinates (i,j) values to node index values vector<int> reverseMapI; // Mapping from node index values to map latitude i value vector<int> reverseMapJ; // Mapping from node index values to map longitude j value }; 1. Using the above class map, write function 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. 2. Write a recursive function findPathRecursive(graph &g, stack<int> &moves) that looks for a path from the start island to the destination island. If a path from the start to the destination exists, your function should call the map::printPath() function that should print a sequence of correct moves (Go left, Go right, Go down, Go up, etc.). If no path from the start to the destination exists, the program should print, "No path exists". If a solution exists the solver should also simulate the solution to each map by calling the map::print() function. The map::print() function prints out a map visualization, with the goal and current position of the car in the map at each move, marked to show the progress. Hint: consider recursive-DFS. 3. Write a function findPathNonRecursive1(graph &g, stack<int> &moves) that does the same thing as in 2, but by using stack and without using recursion. If a path from the start to the destination exists, your function should call the map::printPath() function that should print a sequence of correct moves (Go left, Go right, Go down, Go up, etc.). If no path from the start to the destination exists, the program should print, "No path exists". If a solution exists the solver should also simulate the solution to each map by calling the map::print() function. The map::print() function prints out a map visualization, with the goal and current position of the car in the map at each move, marked to show the progress. Hint: consider stack-based DFS. 4. Write a function findPathNonRecursive2(graph &g, queue<int> &moves) that does the same thing as in 2, but by using queue and without using recursion. If a path from the start to the destination exists, your function should call the map::printPath() function that should print a sequence of correct moves (Go left, Go right, Go down, Go up, etc.). If no path from the start to the destination exists, the program should print, "No path exists". If a solution exists the solver should also simulate the solution to each map by calling the map::print() function. The map::print() function prints out a map visualization, with the goal and current position of the car in the map at each move, marked to show the progress. Hint: consider queue-based BFS. The code you submit should apply all three findPath functions to each map, one after the other. The map input files named map1.txt, map2.txt, and map3.txt can be downloaded from the canvas. Example of a map input file: 7 10 Start - 0XXXXXXXXX 00000000XX
  • 3. 0X0X0X0XXX 0X0X0X0000 XX0XXX0XXX X0000000XX XXXXXXX000Z - Destination Thus, You should submit a single zip folder within which you need to have 4 files including, 1) a single ".cpp" code file that includes all the above-required functions called from a single main function, 2) a single ".h" header file, 3) README file with the compile and execution instructions, and 4) your pre-compiled ".exe" executable file. On top of your .cpp code file, .h header file, and README file, you need to mention your name as comments. You may have an additional PDF file if you want to narrate your additional observations about running the functions of this project, e.g., drawing the graph to compare the runtime and explain the results. All submitted code files must be named as "<your-name>.cpp". For example, it will be "jankibhimani.cpp", "jankibhimani_graph.h", and "jankibhimani.exe". The zip folder containing all the files should be named as "<your- name>_code.zip". For example, it will be "jankibhimani_code.zip". Please follow the Guidelines for Software Engineering Techniques.pdf and Assignments and Project Style and Documentation Guidelines.pdf made available to you in your Student Resources module for other document editing and code format guidelines. Some header files you may need are following, that can be found in you header files zip folder available to you to download on Canvas. #include <iostream> #include <limits.h> #include "d_except.h" #include <list> #include <fstream> #include "d_matrix.h" #include <queue> #include <vector>