Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Question
Chapter 21.1, Problem 1E
Program Plan Intro
To list the vertices in each connected component after each iteration of CONNECTED-COMPONENETS procedure.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
2. Let G = (V, E) be a directed weighted graph with the vertices V = {A, B, C, D, E, F) and the edges E= {(A, B, 12), (A, D, 17), (B, C, 8), (B, D, 13), (B, E, 15), (B, F, 13), (C, E, 12), (C, F, 25)}, where the third components is the cost.
(a) Write down the adjacency list representation the graph G = (V, E).
How do I do this?
We say a graph G = (V, E) has a k-coloring for some positive integer k if we can assign k different colors to vertices of G such that for every edge (v, w) ∈ E, the color of v is different to the color w. More formally, G = (V, E) has a k-coloring if there is a function f : V → {1, 2, . . . , k} such that for every (v, w) ∈ E, f(v) 6= f(w).3-Color problem is defined as follows: Given a graph G = (V, E), does it have a 3-coloring?4-Color problem is defined as follows: Given a graph G = (V, E), does it have a 4-coloring?Prove that 3-Color ≤P 4-Color.(hint: add vertex to 3-Color problem instance.)
A directed graph G= (V,E) consists of a set of vertices V, and a set of edges E such that each element e in E is an ordered pair (u,v), denoting an edge directed from u to v. In a directed graph, a directed cycle of length three is a triple of vertices (x,y,z) such that each of (x,y) (y,z) and (z,x) is an edge in E. Write a Mapreduce algorithm whose input is a directed graph presented as a list of edges (on a file in HDFS), and whose output is the list of all directed cycles of length three in G.
Write the pseudocode for the mappers/reducers methods. Also, assuming that there are M mappers, R reducers, m edges and n vertices -- analyze the (upper-bound of the) communication cost(s).
Knowledge Booster
Similar questions
- Make the representation of the following graph in Lucidchart Graph 1 Graph 2 V = {1, 2, 3, 4) V = { a, b, c, d, e, f} D={(1, 2), (2, 3), (3, 4), (4, 1), (1, 3), (2,4)} D = {(a, c), (a, f), (f, c), (c, b), (b, d), (d, e) }arrow_forwardWe are given an undirected connected graph G = (V, E) and vertices s and t.Initially, there is a robot at position s and we want to move this robot to position t by moving it along theedges of the graph; at any time step, we can move the robot to one of the neighboring vertices and the robotwill reach that vertex in the next time step.However, we have a problem: at every time step, a subset of vertices of this graph undergo maintenance andif the robot is on one of these vertices at this time step, it will be destroyed (!). Luckily, we are given theschedule of the maintenance for the next T time steps in an array M [1 : T ], where each M [i] is a linked-listof the vertices that undergo maintenance at time step i.Design an algorithm that finds a route for the robot to go from s to t in at most T seconds so that at notime i, the robot is on one of the maintained vertices, or output that this is not possible. The runtime ofyour algorithm should ideally be O((n + m) ·T ) but you will…arrow_forwardGiven a graph G = (V;E) an almost independent set I V is a generalization of an independent set whereeach vertex u 2 I is connected to at most one other vertex in I but no more. In other words for all u; v 2 Iif (u; v) 2 E then (u; z) =2 E for all z 2 I (equvalently (v; z) =2 E). Note that every independent set is alsoalmost independent. Prove that the problem of nding whether there exists an almost independent set ofsize k for some k, is NP-complete.arrow_forward
- An undirected graph, G = {V, E}, defined as follows: V = {a, b, c, d, e, f, g, h, i, j, k, l, m} , E = {(a, b), (a, d), (a, h), (b, c), (b, d), (b, e), (c, f), (d, h), (d, i), (e, f), (e, i), (e, j), (f, g), (f, j), (f, k), (g, k), (h, i), (h, l), (i, j), (i, m), (j, m), (k, m), (l, m)} Please give the Graph figure (10%) and its Adjacency List with increasing order by alphabet (10%). After that, present its DFS Spanning Tree (15%) and BFS Spanning Tree (15%) from Vertex C. You can insert your hand-drawn figure into the replying web page or insert a hyperlink, which connects to a public cloud space saving your answer in hand-drawn figures or other types presentations.arrow_forwardDraw the graph G = (V, E) with a vertex-set V = {1,2,3,4}and edge-set E = {(1,2),(3,2),(4,3),(1,4),(2,4)}. Find the size of the biggest clique ω(G) and the size of the biggest independent set α(G).arrow_forwardAn undirected graph G is defined by its edge list [(0, 1, 3), (0, 4,3), (1, 2, 6), (1, 4, 4), (1, 3, 8), (2, 3, 4), (2, 4,9), (3,4,7)]. where w in each tuple (u, v, w) is the weight of edge (u, v). Find the minimal spanning tree using Prim's algrithm starting from vertex 0. Write the edges in the order in which they are added to the spanning tree. Solution [Write here your solution....arrow_forward
- You are given a bipartite graph G=(U,V,E), and an integer K. U and V are the two bipartitions of the graph such that |U| = |V| = N , and E is the edge set. The vertices of U are {1,2,...,N } and that of V are {N+1,N+2,...,2N }. You need to find out whether the total number of different perfect matchings in G is strictly greater than K or not. Recall that a perfect matching is a subset of E such that every vertex of the graph belongs to exactly one edge in the subset. Two perfect matchings are considered to be different even if one edge is different. Write a program in C++ programming language that prints a single line containing “Perfect” if the number of perfect matchings is greater than K, and “Not perfect” in other cases.Sample Input:3 5 21 42 62 53 53 5Output:Not Perfectarrow_forwardSay that a graph G has a path of length three if there exist distinct vertices u, v, w, t with edges (u, v), (v, w), (w, t). Show that a graph G with 99 vertices and no path of length three has at most 99 edges.arrow_forward4. Let G=(V, E) be the following undirected graph: V = {1, 2, 3, 4, 5, 6, 7, 8} E = {(1, 7) (1, 4), (1, 6), (6, 4), (7, 5), (2, 5), (2, 4), (4, 3), (4, 8), (8, 3), (3, 5)}. a. Draw G. b. Is G connected? c. Give the adjacency matrix for the graph G given above. d. Determine whether the graph has a Hamiltonian cycle. If the graph does have a Hamiltonian cycle, specify the nodes of one. If it does not, prove that it does not have one. e. Determine whether the graph has a Euler cycle. If the graph does have a Euler cycle, specify the nodes of one. If it does not, prove that it does not have one.arrow_forward
- Given the following undirected unweighted graph G(V, E). a C What is E? b d earrow_forwardDraw the graph G = (V, E) with a vertex-set V = {1,2,3,4}and edge-set E = {(1,2),(3,2),(4,3),(1,4),(2,4)}. Find the maximal and minimal degrees and the minimal number of colors needed to color the graph.arrow_forwardConsider a graph G = (V, E). V = {a, b, c, d, e, f, g, h, i, j} and E = { {f, h}, {e, d}, {c, b}, {i, j}, {a, b}, {i, f}, {f, j} }. which of the follwing is true about {g}? O It is not a connected component because there is no {g} in E. It is not a connected component because there is no {g} in V. It is a connected component. O It is not a connected component because {g} is just a single node.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education