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...



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<br>x Detah<br>mplemento<br>include ciestrea<br>include
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 "/>
Extracted 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<br>Ti me<br>ivt<br>

Extracted text: vte Ti me ivt
Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here