Question: Create a C + + application called main.cpp that loads ( reads ) a graph in the form of an adjacency matrix, saves it
Create a C application called "main.cpp that loads reads a graph in the form of an adjacency matrix, saves it as an adjacency matrix and as an adjacency list. The node labels are: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z AA AB AC AD
The program must display the adjacency matrix, and then the adjacency list
Then the program must show the BFS and DFS traversal starting from the first node of the graph.
The following two functions must be implemented:
DFS
Description: Print the DFS Depth Traversal starting from the initial node.
Input: The Adjacency Matrix and an integer representing the initial node.
Output: Nothing
Precondition: The initial node must exist and the graph must be correctly loaded in the adjacency matrix.
Postcondition: None
BFS
Description: Print the BFS BreadthWidth Traversal starting from the start node.
Input: The Adjacency List and an integer representing the start node.
Output: None
Precondition: The start node must exist and the graph must be correctly loaded in the adjacency list.
Postcondition: None
Input:
An integer N indicating the number of nodes contained in the graph, followed by N lines with N boolean values each line.
Output:
The adjacency matrix
The adjacency list
BFS starting at the first node value sequence, first node is A then B and so on separated by a blank, a space at the end
DFS starting at the first node value sequence, first node is A then B and so on separated by a blank, a space at the end
Input example:
Output example:
A B E H
B A C E
C B D E F
D C
E A B C G H
F C J
G E J
H A E I J
I H
J F G H
A B E H C G I J D F
A B C D E G J F H I
There is a blank line between each part of the output
All functionalities must be correctly aligned and documented. The complexity of each of them must be included as part of the documentation.
The maximum number of nodes is from node A B C Z AA AB ZZ
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z AA AB AC AD AE AF AG AH AI AJ AK AL AM AN AO AP AQ AR AS AT AU AV AW AX AY AZ BA BB BC BD BE BF BG BH BI BJ BK BL BM BN BO BP BQ BR BS BT BU BV BW BX BY BZ CA CB CC CD CE CF CG CH CI CJ CK CL CM CN CO CP CQ CR CS CT CU CV CW CX CY CZ DA DB DC DD DE DF DG DH DI DJ DK DL DM DN DO DP DQ DR DS DT DU DV DW DX DY DZ EA EB EC ED EE EF EG EH EI EJ EK EL EM EN EO EP EQ ER ES ET EU EV EW EX EY EZ FA FB FC FD FE FF FG FH FI FJ FK FL FM FN FO FP FQ FR FS FT FU FV FW FX FY FZ GA GB GC GD GE GF GG GH GI GJ GK GL GM GN GO GP GQ GR GS GT GU GV GW GX GY GZ HA HB HC HD HE HF HG HH HI HJ HK HL HM HN HO HP HQ HR HS HT HU HV HW HX HY HZ IA IB IC ID IE IF IG IH II IJ IK IL IM IN IO IP IQ IR IS IT IU IV IW IX IY IZ JA JB JC JD JE JF JG JH JI JJ JK JL JM JN JO JP JQ JR JS JT JU JV JW JX JY JZ KA KB KC KD KE KF KG KH KI KJ KK KL KM KN KO KP KQ KR KS KT KU KV KW KX KY KZ LA LB LC LD LE LF LG LH LI LJ LK LL LM LN LO LP LQ LR LS LT LU LV LW LX LY LZ MA MB MC MD ME MF MG MH MI MJ MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NB NC ND NE NF NG NH NI NJ NK NL NM NN NO NP NQ NR NS NT NU NV NW NX NY NZ OA OB OC OD OE OF OG OH OI OJ OK OL OM ON OO OP OQ OR OS OT OU OV OW OX OY OZ PA PB PC PD PE PF PG PH PI PJ PK PL PM PN PO PP PQ PR PS PT PU PV PW PX PY PZ QA QB QC QD QE QF QG QH QI QJ QK QL QM QN QO QP QQ QR QS QT QU QV QW QX QY QZ RA RB RC RD RE RF RG RH RI RJ RK RL RM RN RO RP RQ RR RS RT RU RV RW RX RY RZ SA SB SC SD SE SF SG SH SI SJ SK SL SM SN SO SP SQ SR SS ST SU SV SW SX SY SZ TA TB TC TD TE TF TG TH TI TJ TK TL TM TN TO TP TQ TR TS TT TU TV TW TX TY TZ UA UB UC UD UE UF UG UH UI UJ UK UL UM UN UO UP UQ UR US UT UU UV UW UX UY UZ VA VB VC VD VE VF VG VH VI VJ VK VL VM VN VO VP VQ VR VS VT VU VV VW VX VY VZ WA WB WC WD WE WF WG WH WI WJ WK WL WM WN WO WP WQ WR WS WT WU WV WW WX WY WZ XL XM XN XO XP XQ XR XS XT XU XV XW XX XY ZJ ZK ZL ZM ZN ZO ZP ZQ ZR ZS ZT ZU ZV ZW ZX ZY ZZ
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
