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 06:30
Exchanging which type of data uses the least bandwidth? music photographs video voice bandwidth- the amount of data that can be moved between two points in a set time period
Answers: 1
question
Computers and Technology, 22.06.2019 12:50
You have just been hired as an information security engineer for a large, multi-international corporation. unfortunately, your company has suffered multiple security breaches that have threatened customers' trust in the fact that their confidential data and financial assets are private and secured. credit-card information was compromised by an attack that infiltrated the network through a vulnerable wireless connection within the organization. the other breach was an inside job where personal data was stolen because of weak access-control policies within the organization that allowed an unauthorized individual access to valuable data. your job is to develop a risk-management policy that addresses the two security breaches and how to mitigate these risks.requirementswrite a brief description of the case study. it requires two to three pages, based upon the apa style of writing. use transition words; a thesis statement; an introduction, body, and conclusion; and a reference page with at least two references. use a double-spaced, arial font, size 12.
Answers: 1
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
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