Create the following operations and include a menu-driven main program that will demonstrate your operations. The program will only stop when the user chooses 5 Exit Program. Create Graph a. Adjacency List b. Adjacency Matrix Traversal (User will input the source / start) a. BFS b. DFS Find Path (Given source and destination) Path Cost (Given source and destination) Exit Program Main Program NOTE: Users will input name of places as string and your program will do the manipulation to convert it to an integer vertex. Also, you will have to convert integer vertex back to string when displaying back output to users. Cost will the basis on what vertex to take in BFS and DFS. Cost will only be displayed in option 4. (DEV C)(C++)
Create the following operations and include a menu-driven main program that will demonstrate your operations. The program will only stop when the user chooses 5 Exit Program. Create Graph a. Adjacency List b. Adjacency Matrix Traversal (User will input the source / start) a. BFS b. DFS Find Path (Given source and destination) Path Cost (Given source and destination) Exit Program Main Program NOTE: Users will input name of places as string and your program will do the manipulation to convert it to an integer vertex. Also, you will have to convert integer vertex back to string when displaying back output to users. Cost will the basis on what vertex to take in BFS and DFS. Cost will only be displayed in option 4. (DEV C)(C++)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Create the following operations and include a menu-driven main
- Create Graph
a. Adjacency List
b. Adjacency Matrix - Traversal (User will input the source / start)
a. BFS
b. DFS - Find Path (Given source and destination)
- Path Cost (Given source and destination)
- Exit Program
- Main Program
NOTE: Users will input name of places as string and your program will do the manipulation to convert it to an integer vertex. Also, you will have to convert integer vertex back to string when displaying back output to users. Cost will the basis on what vertex to take in BFS and DFS. Cost will only be displayed in option 4. (DEV C)(C++)
![Mainpp
x Detah
mplemento
include ciestrea
include "Data.h
using nanespace stdj
1nt ain()
Int chi
Graph sta):
cout e "Graph Operations" e endl;
cout e "(1) Adjacency List" e endl;
cout e "(2] Adjacency Hatrix endt;
cout e "Enter choice "I
cin chị
if (ch 1)
10
11
12
13
14
15
E.addEdge(e, )
E.addEdge(1, s):
E.addEdge(2, );
E.addidge(2, 4):
16
17
18
19
20
E.addEdge(3, 5);
E. addtdge(4, ):
E.addEdge(4,
E. addedge(s, 7):
E-addidge(6, )
E.addtdge(6, 7)
E-printGraph (
cout e endl « "DFS Traversal... endl
E.DFS(1)
cout ce endl ce endl
cout endt « ars Traversal... ce endl;
E.BFS(3)
21
22
23
24
25
24
27
28
29
30
31
32
33
else if (ch 2)
34
a5
E.addEdge2 (, 6);
E. addedge2 (1,
E-addedgea (2, )
E. addedge2 (2, 4);
E-addEdgea (, 5)
E.addedge2 (4, 1)
E-addidge2(4, ):
E.addEdgez (s, T);
E-addEdgea (6, 1);
E.addedge2 (6,
E-printirapha):
36
37
38
29
41
42
43
44
45
cout endi endl;
Main pp
Dwa
pragna once
include <1ist>
include iostream
using namespace std
class Graph
private:
int V
List eint adj:
int adj2;
void DFSUT1L(int v, bool visited[1);
I/Progranmera
/Progranmer2
ILead
11
12
13
void BFSUEIL(int s, bool visited (0): /Lead
14
15
publie
Graph(int)
16
17
IJALL
IALL
votd addedge(int u, int v)i
void addEdge2(int u, int v):
IProgrammer2
votd printoraph()
void printGrapha)
void OFS(int v)I
void BrS(int a):
19
IJALL
IProgrammera
ILead
20
21
22
I/Lead
23
24](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fefec5be9-1113-4769-8c1b-570459b6362f%2F444e837d-b041-4177-a367-b7d505d62210%2Fevvw05_processed.png&w=3840&q=75)
Transcribed Image Text:Mainpp
x Detah
mplemento
include ciestrea
include "Data.h
using nanespace stdj
1nt ain()
Int chi
Graph sta):
cout e "Graph Operations" e endl;
cout e "(1) Adjacency List" e endl;
cout e "(2] Adjacency Hatrix endt;
cout e "Enter choice "I
cin chị
if (ch 1)
10
11
12
13
14
15
E.addEdge(e, )
E.addEdge(1, s):
E.addEdge(2, );
E.addidge(2, 4):
16
17
18
19
20
E.addEdge(3, 5);
E. addtdge(4, ):
E.addEdge(4,
E. addedge(s, 7):
E-addidge(6, )
E.addtdge(6, 7)
E-printGraph (
cout e endl « "DFS Traversal... endl
E.DFS(1)
cout ce endl ce endl
cout endt « ars Traversal... ce endl;
E.BFS(3)
21
22
23
24
25
24
27
28
29
30
31
32
33
else if (ch 2)
34
a5
E.addEdge2 (, 6);
E. addedge2 (1,
E-addedgea (2, )
E. addedge2 (2, 4);
E-addEdgea (, 5)
E.addedge2 (4, 1)
E-addidge2(4, ):
E.addEdgez (s, T);
E-addEdgea (6, 1);
E.addedge2 (6,
E-printirapha):
36
37
38
29
41
42
43
44
45
cout endi endl;
Main pp
Dwa
pragna once
include <1ist>
include iostream
using namespace std
class Graph
private:
int V
List eint adj:
int adj2;
void DFSUT1L(int v, bool visited[1);
I/Progranmera
/Progranmer2
ILead
11
12
13
void BFSUEIL(int s, bool visited (0): /Lead
14
15
publie
Graph(int)
16
17
IJALL
IALL
votd addedge(int u, int v)i
void addEdge2(int u, int v):
IProgrammer2
votd printoraph()
void printGrapha)
void OFS(int v)I
void BrS(int a):
19
IJALL
IProgrammera
ILead
20
21
22
I/Lead
23
24
![vte
Ti me
ivt](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fefec5be9-1113-4769-8c1b-570459b6362f%2F444e837d-b041-4177-a367-b7d505d62210%2Fu3otf4q_processed.png&w=3840&q=75)
Transcribed Image Text:vte
Ti me
ivt
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education