CS 303L Data Structure and Algorithm March 7, 2008 Homework 4 (Due on March 20, 2008) Assuming that the edges are chosen based on the node priority (e.g. 𝐴𝐵 is chosen before 𝐴𝐶 ; 𝐵𝐷 is chosen before 𝐵𝐸 ), and assuming the search remembers previous-visited nodes and will not repeat them. Please answer the questions on the basis of the given graphs 1. AHGFEDCBIJ KL M Starting from A (the green node) (a) Please represent the graph with array approach Solution: A B C D E F G H I J K L M A - 1 1 0 0 0 0 0 0 0 0 0 0 B 1 - 0 1 1 0 0 0 0 0 0 0 0 C 1 0 - 0 0 0 0 0 0 0 0 0 0 D 0 1 0 - 0 0 0 0 0 0 0 0 0 E 0 1 0 0 - 1 1 0 0 0 0 0 0 F 0 0 0 0 1 - 0 0 0 0 0 0 0 G 0 0 0 0 1 0 - 1 1 0 0 0 0 H 0 0 0 0 0 0 1 - 0 1 1 0 0 I 0 0 0 0 0 0 1 0 - 0 0 0 0 J 0 0 0 0 0 0 0 1 0 - 0 1 1 K 0 0 0 0 0 0 0 1 0 0 - 0 0 L 0 0 0 0 0 0 0 0 0 1 0 - 0 M 0 0 0 0 0 0 0 0 0 1 0 0 -