
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Implement the following

Transcribed Image Text:blockDFS(v)
pred(v) = num(v) = i++;
for all vertices u adjacent to V
if edge(vu) has not been processed undirected graphs
push(edge(vu));
if num(u) is 0
blockDFS(u);
if pred(u) > num(v)
e = pop();
while e + edge(vu)
Connectivity in
%3D
// if there is no edge from u to
// a vertex above v, output a block
// by popping all edges off the stack
// until edge(vu) is popped off;
output e;
e = pop();
%3D
// e == edge(vu);
output ē;
else pred(v) = min(pred(v),pred(u)); // take a predecessor higher up in
else if u is not the parent of V
pred(v) = min(pred(v),num(u));// update when back edge(vu) is found;
// the tree;
blockSearch()
for all vertices V
num(v) = 0;
%3D
%3D
while there is a vertex V such that num(v) == 0
blockDFS(v);
Connectivity in undirected
granhs: example
blockDFS(a)
num(a) pred(a) = 1
push edge(ac)
blockDFS(C)red(c) = 2
%D
num

Transcribed Image Text:a 0 0: c d
b 0 0: d f
parent: 0
parent: 0
с о 0: а е
d 0 0: a be f
е 0 0: с d
fo 0: b dgh
parent: 0
parent: 0
parent: 0
parent: 0
g 0 0: f
h0 0: f
DFS (a)
parent: 0
parent: 0
num (a) = pred (a) = 1
trying edge (ac)
push (edge (ac))
DFS (c)
%3D
num (c) =
pred (c)
%3D
trying edge (ca)
trying edge (ce)
push (edge (ce))
DFS (e)
num (e)
pred (e) = 3
%3D
%3D
trying edge (ec)
trying edge (ed)
push (edge (ed))
DFS (d)
num (d)
pred (d) = 4
trying edge (da)
push (edge (da))
pred2 (d) = 1 (= num (a))
trying edge (db)
push (edge (db))
DFS (b)
%3|
=
trying edge (bd)
trying edge (bf)
push (edge (bf))
DFS (f)
num (b)
pred (b) = 5
num (f)
trying edge (fb)
trying edge (fd)
push(edge (fd))
pred2 (f) = 4 (= num (d))
trying edge (fg)
push (edge (fg))
DFS (g)
num (g) =
trying edge (gf)
BLOCK: edge (fg)
trying edge (fh)
push (edge (fh))
DFS (h)
pred (f) = 6
%3D
pred (g) = 7
num (h) = pred (h) = 8
trying edge (hf)
BLOCK: edge (fh)
%3D
pred (b) = 4 (= pred(f))
BLOCK: edge (fd) edge (bf) edge (db)
trying edge (de)
trying edge (df)
pred (e) = 1 (= pred(d))
%3D
%3D
pred (c) = 1 (= pred(e))
BLOCK: edge (da) edge (ed) edge (ce) edge(ac)
trying edge (ad)
a 1 1: с d
b 5 4: d f
%3D
parent: 0
parent: d
c 2 1:
d 4 1: a bef
e 3 1: c d
f 6 4: bdgh
g 7 7: f
h 8 8: f
a e
parent: a
parent: e
parent: c
parent: b
parent: f
parent: f
2.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Can I please get the c++ code for this as well? Thank you.
Solution
by Bartleby Expert
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Can I please get the c++ code for this as well? Thank you.
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Implement Dijkstra's algorithm to find the shortest path between two nodes in a graph. What is the time complexity of your solution?arrow_forwardNote: Solve the following question and please don't repost previous answers and don't give a computer generated answer. Problem: Draw a simple, connected, directed, weighted graph with 9 vertices and 17 edges, each with unique edge weights. Identify one vertex as a “start” vertex and illustrate a running of Dijkstra’s algorithm on this graph.arrow_forwardWe have the following directed graph G, where the number on each edge is the cost of the edge. 1. Step through Dijkstra’s Algorithm on the graph starting from vertex s, and complete the table below to show what the arrays d and p are at each step of the algorithm. For any vertex x, d[x] stores the current shortest distance from s to x, and p[x] stores the current parent vertex of x. 2. After you complete the table, provide the returned shortest path from s to t and the cost of the path.arrow_forward
- Please help me with this practice problem in python : Implement two-level iterative method B = B_{TL} for graph Laplacian matrices. We want the symmetric B. Components: Given a graph, construct its graph Laplacian matrix. Then using Luby's algorithm, construct the P matrix that ensures a prescribed coarsening factor, e.g., 2, 4, or 8 times smaller number of coarse vertices. Since the graph Laplacian matrix is singular (it has the constants in its nullspace), to make it invertible, make its last row and columns zero, but keep the diagonal as it were (nonzero). The resulting modified graph Laplacian matrix A is invertible and s.p.d.. Form the coarse matrix A_c = P^TAP. To implement symmetric two-level cycle use one of the following M and M^T: (i) M is forward Gauss-Seidel, M^T - backward Gauss-Seidel (both corresponding to A) (ii) M = M^T - the ell_1 smoother. Compare the performance (convergence properties in terms of number of iterations) of B w.r.t. just using the smoother M…arrow_forwardWrite a program RandomSparseGraph to generate random sparse graphs for a well-chosen set of values of V and E such that you can use it torun meaningful empirical tests on graphs drawn from the Erdös-Renyi modelarrow_forwardGiven a graph that is a tree (connected and acyclic). (1) Pick any vertex v. (II) Compute the shortest path from v to every other vertex. Let w be the vertex with the largest shortest path distance. (III) Compute the shortest path from w to every other vertex. Let x be the vertex with the largest shortest path distance. Consider the path p from w to x. Which of the following are true a. p is the longest path in the graph b. p is the shortest path in the graph c. p can be calculated in time linear in the number of edges/vertices a,c a,b a,b,c b.carrow_forward
- Write a functionIsItASpanningSubgraph (G,H) which takes as input two graphs in nx format (not as dictionaries) and outputs True if H is a spanning subgraph of G and False otherwise.arrow_forwardSuppose you have a graph with 100 nodes and 500 edges and you want to find the shortest path between two nodes using Dijkstra's algorithm. What is the time complexity of this operation?arrow_forwardShow the steps of the Dijkstra algorithm on the graph below, as done in class, starting with node C. Graph of 4 nodes А 1 3 D Farrow_forward
- Write an algorithm using depth-first search that determines if a graph is bipartite. What is the complexity of your algorithm?arrow_forwardWe recollect that Kruskal's Algorithm is used to find the minimum spanning tree in a weighted graph. Given a weighted undirected graph G = (V , E, W), with n vertices/nodes, the algorithm will first sort the edges in E according to their weights. It will then select (n-1) edges with smallest weights that do not form a cycle. (A cycle in a graph is a path along the edges of a graph that starts at a node and ends at the same node after visiting at least one other node and not traversing any of the edges more than once.) Use Kruskal's Algorithm to nd the weight of the minimum spanning tree for the following graph.arrow_forwardIt is important to investigate and contrast the advantages and drawbacks of weighted graphs and adjacency lists.arrow_forward
arrow_back_ios
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