Problem

Let G = (V, E) be a directed graph with nodes v1,…,vn. We say that G is an ordered graph i...

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.

(i) 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, vj) with i

(ii) Each node except vn has at least one edge leaving it. That is, for every node vi, i = 1,2,…,n – 1, there is at least one edge of the form (vi, vj).

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 1 for an example).

Given an ordered graph G, find the length of the longest path that begins at v1 and ends at vn.

(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.

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 returns the length of the longest path that begins at v1 and ends at vn. (Again, the length of a path is the number of edges in the path.)

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT