Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

photo 1 is the question, photo 2 and 3 is the algorithm, photo 4 is the example, photo 5 is the graphs of question. I

photo 1 is the question, photo 2 and 3 is the algorithm, photo 4 is the example, photo 5 is the graphs of question. I just don't understand the example. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. Exercise 9.3.4: Apply the Breadth First Search (BFS) algorithm (9.3.8) to determine the shortest path from vertex a to vertex i in the two graphs shown in Figure 9.3.12 (p. 213). Display the results of applying the algorithm using a table like the one shown in Example 9.3.10. in totd a tietherarti Algorithm 9.3.8 Breadth-first Search. A broadcasting algorithm for finding a path between verter i and verterj of a graph having n vertices. Each item Vk of a list V = {V1, V2, ...,Vn}, consist of a Boolean field V.found and an integer field Vk.from. The sets D1, D2,..., called depth sets, have the property that if ke Dr, then the shortest path from verter i to verter k is of length r. In Step 5, a stack is used to put the verter list for the path from the verter i to verter j in the proper order. (1) Set the value V.found equal to False, k = 1,2,..., (2) r = 0 (3) Do = {i} (4) while (-V, found) and (D, *) D.+1=0 for each k in D, for each edge (k,t): I V. found == False; Vi found = True V from=k D.+1 = D.+1 ) .rar+1 (5) if V, found CHAPTER 9. GRAPH THEORY 210 S = EmptyStack while Vi.from *i: Push k onto S k - V from This algorithm will produce one path from vertex i to vertex j, if one exists, and that path will be as short as possible. If more than one path of this length exists, then the one that is produced depends on the order in which the edges are examined and the order in which the elements of D, are examined in Step 4. The condition D ) is analogous to the condition that no mail is sent inn given stage of the process in which case MISU cannot be connected to ESU. This algorithm can be easily revised to tind paths to all vertices that can be reached from vertex Step 5 would be put off until a specific path to a vertex is needed since the information in contains an efficient list of all patlis. The algorithm can also be extended further to find paths between any two vertices List 9.3.9 Figure 9.3.11: A simple example of breadth-first search Suppose that the edges from each vertex are sorted in ascending order by terminal vertex. For example, the edges from vertex 3 would be in the order (3.1). (3.1). (3.5). In addition, assume that in the body of Step 4 of the algorithm, the elements of D, are used in ascending order. Then at the end of Step 1. the value of l will be 1 2 3 4 5 6 found TTTTTT Vfrom 2011 Depthset 13223 Theo teda the path12.1.1.6 i prod a y the algorithm. Note that if we rom 2 to the count on m e the path Figure 9.3.12: Shortest paths from a to

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions