Question: C++ array-pointer representation of a graph For this lab you will read in the array-pointer representation of a graph, tell which nodes are isolated, and
C++ array-pointer representation of a graph

For this lab you will read in the array-pointer representation of a graph, tell which nodes are isolated, and print out the adjacency matrix. There will be no more than 5 nodes in the graph, and there will be no parallel edges, so the array-pointer must be size 30X2 (the graphs will be unweighted) and the adjacency matrix must be 5X5. But that doesn't mean that all of that will actually be used or printed since there could be fewer nodes and fewer edges. Your program will need to ask how many nodes are in the graph and how many rows are in the array-pointer prior to reading the array-pointer representation. It will then create the adjacency matrix, then print out which nodes are isolated followed by-printing the adjacency matrix. NOTE 1: A comment with your name should be the first line in the file. Note 2: -1 will mean end of list in the array-pointer. Note 3: A mathematician is inputting the array-pointer, so they will start numbering at 1 for the node names and index locations. Note 4: the array locations that are normally empty in an array-pointer that are for the head pointers for the lists will have the node names. This will make it easier to code. Note 5: Remember a graph can be directed so a node is really not isolated unless both its row and column in the adjacency matrix are 0, but you could shortcut by only checking the columns in the adjacency matrix of the nodes whose initial entry in the array-pointer is -1 (that guarantees a row of all 0's). Sample runs follow: Run 1 Please input the number of nodes: 3 How many rows are in the array-pointer representation? 5 Please input the array-pointer representation of the graph: 1 4 node 3 is isolated The adjacency matrix is 0 1 0 1 0 0 0 0 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
