Question: We will build a simple graph data structure. It will be composed of node objects. Read about directional and nondirectional graphs. We will build a
We will build a simple graph data structure. It will be composed of node objects. Read about directional and nondirectional graphs. We will build a non-directional graph in this work. Q1) node1.cpp class which has the following properties: id:integer An array of node pointers where array is fixed in size, 5. i) a) Implement setter and getter functions for "Id". Do simple tests in main function. b) Implement bool overwriteNeighborNode(index i, Node n) member function. If you successfully overwrite the node at the index i, return true, else return false. Do simple tests in main function. c) Implement Node getNeighbor Atindex(index 1) member function. You should return the node at index i. Do simple tests in main function. d) In the main function: Create a node where id-1 Create a node where id=2 iii) Create a node where id=3 iv) Add node-1 and node-2 as neighbors to each other both at index=0 V) Add node-2 and node-3 as neighbors to each other both at index=0 vi) cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
