Exercise 1: Building Both Representations for {P,Q,R,S} — Possible Solution ==================================================================== GIVEN ------------------------------ Vertices: P, Q, R, S Edges: P-Q, P-R, Q-R, R-S ADJACENCY MATRIX ------------------------------ P Q R S P [0, 1, 1, 0] Q [1, 0, 1, 0] R [1, 1, 0, 1] S [0, 0, 1, 0] ADJACENCY LIST ------------------------------ P: [Q, R] Q: [P, R] R: [P, Q, S] S: [R] DEGREE OF EACH VERTEX ------------------------------ degree(P) = 2 (connects to Q and R) degree(Q) = 2 (connects to P and R) degree(R) = 3 (connects to P, Q, and S) degree(S) = 1 (connects only to R) WHY THIS WORKS AS AN ANSWER ------------------------------ Both representations are built directly from the given edge list using this chapter's own construction method (marking both directions in the matrix, appending both directions in the list, since the graph is undirected), and each vertex's degree is read directly from the length of its own adjacency list entry, matching the chapter's own worked example's approach.