Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2. (1 marks) We say that a node u of a directed graph G (V, E) is a supersource, if there is an edge

image text in transcribed

Question 2. (1 marks) We say that a node u of a directed graph G (V, E) is a supersource, if there is an edge from u to every other node in G and there is no edge from any node into u, i.e., for all uu E V, (u,v) E E and for all u e V, (v,u) E. a. Suppose the directed graph G (V, E) is given by its adjacency matriz A. Give an efficient algorithm to determine whether G has a supersource node, and if so, to output it. Your algorithm should minimize the number of accesses to the adjacency matrix A in the worst-case (e.g., reading an arbitrary element Ali,j of A counts as one access to A). Describe your algorithm using pseudo-code and prove it correct (it is convenient to assume that the set of nodes of G is V 1,2,..,n)). b. How many times your algorithm accesses the adjacency matrix A of the graph G in the worst-case? Give the eract number (i.e., do not use the asymptotic notation) as a function of the number of nodes n = IVI and the number of edges rn = El of G, and justify your answer c. Solve part (a) and (b) above under the assumption that the directed graph G = (V, E) is given by its adjacency lists L (instead of its adjacency matrix A). Question 2. (1 marks) We say that a node u of a directed graph G (V, E) is a supersource, if there is an edge from u to every other node in G and there is no edge from any node into u, i.e., for all uu E V, (u,v) E E and for all u e V, (v,u) E. a. Suppose the directed graph G (V, E) is given by its adjacency matriz A. Give an efficient algorithm to determine whether G has a supersource node, and if so, to output it. Your algorithm should minimize the number of accesses to the adjacency matrix A in the worst-case (e.g., reading an arbitrary element Ali,j of A counts as one access to A). Describe your algorithm using pseudo-code and prove it correct (it is convenient to assume that the set of nodes of G is V 1,2,..,n)). b. How many times your algorithm accesses the adjacency matrix A of the graph G in the worst-case? Give the eract number (i.e., do not use the asymptotic notation) as a function of the number of nodes n = IVI and the number of edges rn = El of G, and justify your answer c. Solve part (a) and (b) above under the assumption that the directed graph G = (V, E) is given by its adjacency lists L (instead of its adjacency matrix A)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions