Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5. [Graph Representation] Consider the following undirected graph G. 2 0 5 (i) D

ID: 3708154 • Letter: 5

Question

5. [Graph Representation] Consider the following undirected graph G. 2 0 5 (i) Draw the adjacency-lists representation and the adjacency matrix representation of G. 8 Marks] (ii) Give an example of a graph operation for which adjacency lists are better than adjacency matrices and one operation for which adjacency matrices are better than adjacency lists. 12 Marks)

Explanation / Answer

adjacency list: 1 -> 2 -> 3 2 -> 1 -> 3 -> 4 -> 5 3 -> 1 -> 2 -> 4 -> 6 4 -> 2 -> 3 -> 5 -> 6 -> 7 5 -> 2 -> 4 -> 7 6 -> 3 -> 4 -> 7 7 -> 4 -> 5 -> 6 adjacency matrix: 1 -> 0 1 1 0 0 0 0 2 -> 1 0 1 1 1 0 0 3 -> 1 1 0 1 0 1 0 4 -> 0 1 1 0 1 1 1 5 -> 0 1 0 1 0 0 1 6 -> 0 0 1 1 0 0 1 7 -> 0 0 0 1 1 1 0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote