Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started