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
icon
Related questions
Question

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.

  1. Create Graph
    a. Adjacency List
    b. Adjacency Matrix
  2. Traversal (User will input the source / start)
    a. BFS
    b. DFS
  3. Find Path (Given source and destination)
  4. Path Cost (Given source and destination)
  5. Exit Program
  6. 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
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
Transcribed Image Text:vte Ti me ivt
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Graphical User Interface
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education