subject

Chapter 6 problem 3: Let G = (V, E) be a directed graph with nodes v1,..., Vn. We say that G is an ordered graph if it has the following properties.
(1) Each edge goes from a node with a lower index to a node with a higher index. That is, every
directed edge has the form (vi, vy) with i (ii) Each node except v, has at least one edge leaving it. That is, for every node
Vi, i = 1,2,..., 1 - 1, there is at least one edge of the form (Vi, v;). The length of a path is the
number of edges in it. The goal in this question is to solve the following problem (see Figure 6.29 for
an example)
Given an ordered graph G, find the length of the longest path that begins at vi and ends at un
(a) Show that the following algorithm does not correctly solve this problem, by giving an example
of an ordered graph on which it does not return the correct answer.

Figure 6.29 The correct answer for this ordered graph is 3: The longest path from v to
v, uses the three edges (U). Vs), (, Vs), and (V, Vs).
Set w=0
Set L = 0
While there is an edge out of the node w
Choose the edge (w, vy)
for which j is as small as possible
Set w = 0;
Increase L by 1
end while
Return L as the length of the longest path
In your example, say what the correct answer is and also what the algorithm above finds.
(b) Give an efficient algorithm that takes an ordered graph G and retums the length of the longest
path that begins at Uy and ends at vn (Again, the length of a path is the number of edges in the
path.)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:20
Print "usernum1 is negative." if usernum1 is less than 0. end with newline. convert usernum2 to 0 if usernum2 is greater than 10. otherwise, print "usernum2 is less than or equal to 10.". end with newline
Answers: 3
question
Computers and Technology, 22.06.2019 16:20
Octothorpe is another name for what common computer keyboard symbol?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Which tab is used to change the theme of a photo album slide show? a. design b. view c. transitions d. home
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
You know the right answer?
Chapter 6 problem 3: Let G = (V, E) be a directed graph with nodes v1,..., Vn. We say that G is an...
Questions
question
Advanced Placement (AP), 23.10.2019 07:00
question
Physics, 23.10.2019 07:00
Questions on the website: 13722363