Question: Problem 4. (15 marks) Given an undirected graph G = (V,E), the square of it is the graph such that for any two nodes ,

Problem 4. (15 marks) Given an undirected graph G = (V,E), the square of it is the graph Problem 4. (15 marks) Given an undirected graph G = (V,E), the such that for any two nodes square of it is the graph such that for any two nodes , , if and only if the distance between u and v in if and only if the distance between u and v in G is at most 2, i.e., G is at most 2, i.e., or there is a such that or there is a . (Therefore, it is clear that any will remain an edge also such that in .) a. (7 marks) Propose an algorithm that takes as an . (Therefore, it is clear that any input a graph G with a max-degree of in the adjacency list will remain an edge also in model and outputs in , and prove the running time of your.)

a. (7 marks) Propose an algorithm that takes as an input a graph G with a max-degree of algorithm. b. (8 marks) Propose an algorithm that takes as an input in the adjacency list model and outputs a graph G in the adjacency matrix model and outputs G2 in in . Prove the correctness and running time of your algorithm. (Hint: We , and prove the running time of your algorithm.

b. (8 marks) Propose an algorithm that takes as an input a graph G in the adjacency matrix model and outputs G2 in call it an adjacency matrix for a reason...) 2 = { , . Prove the correctness and running time of your algorithm. (Hint: We call it an adjacency matrix for a reason...)

2 = { , 2 )

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!