Implement the necessary primitive functions on graph


Discuss the below:

Q: Modify the program that implements a 6x6 adjacency matrix for a graph. Remember that an adjacency matrix is a two-dimensional array.

The program should implement the necessary primitive functions on graphs:

updateNode(), insertNode(), insertEdge(), deleteNode(), deleteEdge(), retrieve(), and adjacent().

The program should also include a printGraph() method that prints the adjacency matrix.

The output of the program should appear as follows:

Adjacency Matrix:
0 1 2 3 4 5
0 0 1 1 1 0 0
1 0 0 0 0 1 0
2 0 1 0 0 1 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 1 0 1 0 0

The data are:
0: 0
1: 1
2: 2
3: 3
4: 4
5: 5
0 is connected to 1
3 is not connected to 2

Attachment:- adjacenct matrix.rar

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Implement the necessary primitive functions on graph
Reference No:- TGS01931756

Now Priced at $25 (50% Discount)

Recommended (94%)

Rated (4.6/5)