Question: A full proof would be helpful! Thank you 3. [14 marks] Graph algorithm. Let G-(V. E) be a graph, and let V-{0, 1,.. . ,

A full proof would be helpful! Thank youA full proof would be helpful! Thank you 3. [14 marks] Graphalgorithm. Let G-(V. E) be a graph, and let V-{0, 1,.. .

3. [14 marks] Graph algorithm. Let G-(V. E) be a graph, and let V-{0, 1,.. . , n-1} be the vertices of the graph. One common way to represent graphs in a computer program is with an adjacency matrix, a two-dimensional n-by-n array2 M containing 0's and 1's. The entry MI] equals 1 if fi,j} e E, and 0 otherwise; that is, the entries of the adjacency matrix represent the edges of the graph Keep in mind that graphs in our course are symmetric (an edge {i,j) is equivalent to an edge {j, i]), and that no vertex can ever be adjacent to itself. This means that for all i,j [0,1,... ,n - 1), M[i]j] MIjll], and that M[0 The following algorithm takes as input an adjacency matrix M and determines whether the graph contains at least one isolated vertex, which is a vertex that has no neighbours. If such a vertex is found, it then doe s a very large amount of printing i def has_isolated (M): n-len() # n is the number of vertices of the graph found isolated False for i in range (n) : # ?-0, 1, n-1 , count 0 for j in range (n) : 7 # j-0, 1, n-1 , count - count + M[i] [j] if count 0: 10 found isolated - True break 12 if found_isolated: for k in range (2 * n): print ('Degree too small') (a) [3 marks] Prove that the worst-case running time of this algorithm is (2") (b) [3 marks] Prove that the best-case running time of this algorithm is (n2) (c) [1 mark] Let n N. Find a formula for the number of adjacency matrices of size n-by-n that represent valid graphs. For example, a graph G - (V, E) with V- 4 has 64 possible adjacency matrices Note: a graph with the single edge (1,2) is considered different from a graph with the single edge (2,3), and should be counted separately. (Even though these graphs have the same "shape", the vertices that are adjacent to each other are different for the two graphs.) (d) [2 marks] Prove the formula that you derived in Part (c) (e) [2 marks] Let n E N. Prove that the number of n-by-n adjacency matrices that represent a graph n with at least one isolated vertex is at most n . 2(n- (f) [3 marks] Finally, let AC(n) be the average-case runtime of the above algorithm, where the set of inputs is simply all valid adjacency matrices (same as what you counted in part (c)) Prove that AC(n) E ?(r)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!