Question & Answer: Request solve following problem on "Alogrithms"…..

Request solve following problem on “Alogrithms”

7) Show the d and π values that result from running depth-first search on the graph given in Fig.1 using vertex 4 as the source. a) 2 6 7 8 9 Figure 1: Flgure for exercise 7(a)

Show the d and pi values that result from running depth-first search on the graph given in Fig. 1 using vertex 4 as the source.

Expert Answer

 

The DFS algorithm uses——–>

  1. d is used for time discovered
  2. f stands for time finished
  3. π – predecessor vertex

Given Figure ——>

DFS start from 4 —–>

4, 1, 2, 8, 9, 6, 7, 3

DFS figure ———->

Now d and pi value ——->

1 2 3 4 6 7 8 9
d 2 4 9 1 7 8 5 6
f 3 12 10 11 * * * *
pi 4 1,3,4 1 3 4,9 6 2,4,6 2,7,8

* It can never finished by DFS becasue predecessor node not finished(deadlock)

Still stressed from student homework?
Get quality assistance from academic writers!