S.edu/teaching/algorithms/). enotes the book by Dasgupta, Papadimitriou, and Vazirani uestion 1: Let G be a directed graph (not necessarily acycl

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Question 2 is the algorithm in the 2nd picture
cickson] denotes the book by Jeff Erickson (available for free online at http://jeffe
llinois.edu/teaching/algorithms/).
OPV] denotes the book by Dasgupta, Papadimitriou, and Vazirani (the required text-
k).
(1) Question 1: Let G be a directed graph (not necessarily acyclic) in which every
vertex v has a distinct integer weight W v]. Describe an algorithm to find the
length of the longest directed path in G whose vertex weights define a strictly
increasing sequence. Hint: Use DFS and dynamic programming. Let T[v] be
the length of the longest directed path ending at v whose vertex weights define an
increasing sequence.
(2) Question 2: 4.3 of [DPV]. Your algorithm should run in O(|V|³) time. Hint: use
the matrix representation of the graph.
吕口
F3
000
F4
F5
F6
F7
F8
F9
F10
#
$
&
4
5
6
7
8
E
R
Y
U
D
F
G
H
J
K
C
V
N
M
a >
B
Transcribed Image Text:cickson] denotes the book by Jeff Erickson (available for free online at http://jeffe llinois.edu/teaching/algorithms/). OPV] denotes the book by Dasgupta, Papadimitriou, and Vazirani (the required text- k). (1) Question 1: Let G be a directed graph (not necessarily acyclic) in which every vertex v has a distinct integer weight W v]. Describe an algorithm to find the length of the longest directed path in G whose vertex weights define a strictly increasing sequence. Hint: Use DFS and dynamic programming. Let T[v] be the length of the longest directed path ending at v whose vertex weights define an increasing sequence. (2) Question 2: 4.3 of [DPV]. Your algorithm should run in O(|V|³) time. Hint: use the matrix representation of the graph. 吕口 F3 000 F4 F5 F6 F7 F8 F9 F10 # $ & 4 5 6 7 8 E R Y U D F G H J K C V N M a > B
Figure 4.3 Breadth-first search.
procedure bfs (G, s)
Input:
Graph G = (V, E), directed or undirected; vertex sE V
For all vertices u reachable from s, dist(u) is set
Output:
to the distance from s to u.
for all u E V:
dist(u) = ∞
dist(s) = 0
Q = [s] (queue containing just s)
while Q is not empty:
u = eject(Q)
for all edges (u,v) E E:
if dist(v) = ∞:
inject(Q,v)
dist(v) = dist(u)+1
29
吕0
F3
F5
F6
F7
F8
F9
F10
@
$
%
&
*
一
2
4
6
7
9.
W
E
Y
U
S
D
G
H
K
C
V
M.
* CO
B
w #
Transcribed Image Text:Figure 4.3 Breadth-first search. procedure bfs (G, s) Input: Graph G = (V, E), directed or undirected; vertex sE V For all vertices u reachable from s, dist(u) is set Output: to the distance from s to u. for all u E V: dist(u) = ∞ dist(s) = 0 Q = [s] (queue containing just s) while Q is not empty: u = eject(Q) for all edges (u,v) E E: if dist(v) = ∞: inject(Q,v) dist(v) = dist(u)+1 29 吕0 F3 F5 F6 F7 F8 F9 F10 @ $ % & * 一 2 4 6 7 9. W E Y U S D G H K C V M. * CO B w #
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Single source shortest path
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education