Question: Building the component graph. Suppose you run an SCC algorithm that gives you the strongly connected components C1, ...,Ck for a graph G with with

 Building the component graph. Suppose you run an SCC algorithm that

Building the component graph. Suppose you run an SCC algorithm that gives you the strongly connected components C1, ...,Ck for a graph G with with n vertices and m edges. Each Ci is given to you as a list of vertices. From this information, give the details of an algorithm that computes two things: (i) an array mapping v EV to je {1,..., k}, where v E C;; that is, an array Map, indexed by v E V, such that Map[u] = i if v E Ci; (ii) an adjacency list representation of the component graph Gscc; that is, an array L[1..k] where each L[i] is a list of indices j such that i + j is an edge in Gscc. Your algorithm should run in time O(n + m). To be precise: your algorithm should take as input the graph G in adjacency list representation, along with sets C1, ...,Ck. Each C is just a set of vertices (represented, for example, as a list). Note that in your adjacency list representation of GSCC, you should take care that edges in the component graph are not duplicated. For example, if there are two edges in G leading from a vertex in C to a vertex in Cj, the adjacency list L[i] should contain just a single copy of j. Building the component graph. Suppose you run an SCC algorithm that gives you the strongly connected components C1, ...,Ck for a graph G with with n vertices and m edges. Each Ci is given to you as a list of vertices. From this information, give the details of an algorithm that computes two things: (i) an array mapping v EV to je {1,..., k}, where v E C;; that is, an array Map, indexed by v E V, such that Map[u] = i if v E Ci; (ii) an adjacency list representation of the component graph Gscc; that is, an array L[1..k] where each L[i] is a list of indices j such that i + j is an edge in Gscc. Your algorithm should run in time O(n + m). To be precise: your algorithm should take as input the graph G in adjacency list representation, along with sets C1, ...,Ck. Each C is just a set of vertices (represented, for example, as a list). Note that in your adjacency list representation of GSCC, you should take care that edges in the component graph are not duplicated. For example, if there are two edges in G leading from a vertex in C to a vertex in Cj, the adjacency list L[i] should contain just a single copy of j

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!