Source vertex:0
1. Try edge 0 ? 1
Vertex 1 is unvisited, we have a tree edge.
2.Try edge 1 ? 3
Vertex 3 is unvisited, we have a tree edge.
3. Try edge 3 ? 2
Vertex 2 is unvisited, we have a tree edge.
4. Try edge 2 ? 5
Vertex 5 is unvisited, we have a tree edge.
5. Finish DFS(5), backtrack to DFS(2).
6.Try edge 2 ? 6
Vertex 6 is unvisited, we have a tree edge.
7. Try edge 6 ? 7
Vertex 7 is unvisited, we have a tree edge.
8.Try edge 7 ? 4
Vertex 4 is unvisited, we have a tree edge.
9.Finish DFS(4), backtrack to DFS(7).
10. Finish DFS(7), backtrack to DFS(6).
11.Finish DFS(6), backtrack to DFS(2).
12. Finish DFS(2), backtrack to DFS(3).
13.Try edge 3 ? 5
Vertex 5 is visited, we have a forward/cross edge.
14.Try edge 3 ? 6
Vertex 6 is visited, we have a forward/cross edge.
15.Try edge 3 ? 7
Vertex 7 is visited, we have a forward/cross edge.
16.Finish DFS(3), backtrack to DFS(1).
17. Try edge 1 ? 7
Vertex 7 is visited, we have a forward/cross edge.
18 . Finish DFS(1), backtrack to DFS(0).
19. Try edge 0 ? 4
Vertex 4 is visited, we have a forward/cross edge.
20. Try edge 0 ? 7
Vertex 7 is visited, we have a forward/cross edge.
21.DFS(0) is completed. Red/grey/blue edge is tree/cross/forward/backedge of the DFS spanning tree, respectively.
Topological sort:
Vertex 0 has not been visited.
DFS(0).
Try edge 0 ? 1.
List = [].
Vertex 1 has not been visited, continue.
List = [].
DFS(1).
Try edge 1 ? 3.
List = [].
Vertex 3 has not been visited, continue.
List = [].
DFS(3).
Try edge 3 ? 2.
List = [].
Vertex 2 has not been visited, continue.
List = [].
DFS(2)
Try edge 2 ? 5.
List = [].
Vertex 5 has not been visited, continue.
List = [].
DFS(5)
DFS(5) is completed, add {u} to the back of the list.
List = [5].
Try edge 2 ? 6.
List = [5].
Vertex 6 has not been visited, continue.
List = [5].
DFS(6).
Try edge 6 ? 7.
List = [5].
Vertex 7 has not been visited, continue.
List = [5].
DFS(7).
Try edge 7 ? 4.
List = [5].
Vertex 4 has not been visited, continue.
List = [5].
DFS(4)
DFS(4) is completed, add {u} to the back of the list.
List = [5,4].
DFS(7) is completed, add {u} to the back of the list.
List = [5,4,7].
DFS(6) is completed, add {u} to the back of the list.
List = [5,4,7,6].
DFS(2) is completed, add {u} to the back of the list.
List = [5,4,7,6,2].
Try edge 3 ? 5.
List = [5,4,7,6,2].
Vertex 5 has been visited, ignore this edge.
List = [5,4,7,6,2].
Try edge 3 ? 6.
List = [5,4,7,6,2].
Vertex 6 has been visited, ignore this edge.
List = [5,4,7,6,2].
Try edge 3 ? 7.
List = [5,4,7,6,2].
Vertex 7 has been visited, ignore this edge.
List = [5,4,7,6,2].
DFS(3) is completed, add {u} to the back of the list.
List = [5,4,7,6,2,3].
Try edge 1 ? 7.
List = [5,4,7,6,2,3].
Vertex 7 has been visited, ignore this edge.
List = [5,4,7,6,2,3].
DFS(1) is completed, add {u} to the back of the list.
List = [5,4,7,6,2,3,1].
Try edge 0 ? 4.
List = [5,4,7,6,2,3,1].
Vertex 4 has been visited, ignore this edge.
List = [5,4,7,6,2,3,1].
Try edge 0 ? 7.
List = [5,4,7,6,2,3,1].
Vertex 7 has been visited, ignore this edge.
List = [5,4,7,6,2,3,1].
DFS(0) is completed, add {u} to the back of the list.
List = [5,4,7,6,2,3,1,0].
Topological Sort is completed after reversing the list.
List = [0,1,3,2,6,7,4,5]
Student Name: Q5-15 pts) Run the Depth First Search algorithm on the following directed acyclic graph...
Q6: 20 pts) For the directed graph assigned to you, run the Depth First Search algorithm. (a) Clearly show the order in which the vertices are pushed and popped. (b) Clearly write the list of edges and their classification into one of the four categories as determined using DFS. (c) Determine whether the directed graph assigned to you is a DAG or not? If it is a DAG. write the topological sort of the vertices.
Consider the following directed graph for each of the
problems:
1. Perform a breadth-first search on the graph assuming that the
vertices and adjacency lists
are listed in alphabetical order. Show the breadth-first search
tree that is generated.
2. Perform a depth-first search on the graph assuming that the
vertices and adjacency lists
are listed in alphabetical order. Classify each edge as tree, back
or cross edge. Label each
vertex with its start and finish time.
3. Remove all the...
Name J#: Q7:20 pts) Conduct a Depth First Search (DFS) on the graph assigned to you. Clearly indicate the Tree edges and Back edges. Identify the articulation points. Show all the steps (incl. the order the vertices are visited. Start your DES from ationpoints. visited). Start your DES from Vertex 1
Show the operation of depth-first search (DFS) on the graph of Figure 1 starting from vertex q. Always process vertices in alphabetical order. Show the discovery and finish times for each vertex, and the classification of each edge. (b) A depth-first forest classifies the edges of a graph into tree, back, forward, and cross edges. A breadth-first search (BFS) tree can also be used to classify the edges reachable from the source of the search into the same four categories....
Only P9.5.3 Not P9.5.1
Figure 9-7: A directed acyclic graph to be depth-first searched. P9.5.1 Let Gn be a directed acyclic graph similar to that of Figure 9-7 but with n in place of the parameter "4". Suppose that there is no goal node - how many node visits does a depth-first search take to discover this, as a function of n? P9.5.3 How many different paths of length n, starting from the start node, exist in the graph Gn...
Consider a directed acyclic graph G = (V, E) without edge lengths and a start vertex s E V. (Recall, the length of a path in an graph without edge lengths is given by the number of edges on that path). Someone claims that the following greedy algorithm will always find longest path in the graph G starting from s. path = [8] Ucurrent = s topologically sort the vertices V of G. forall v EV in topological order do...
Give the adjacency matrix representation and the adjacency lists representation for the graph G_1. Assume that vertices (e.g., in adjacency lists) are ordered alphabetically. For the following problems, assume that vertices are ordered alphabetically in the adjacency lists (thus you will visit adjacent vertices in alphabetical order). Execute a Breadth-First Search on the graph G_1, starting on vertex a. Specifiy the visit times for each node of the graph. Execute a Depth-First Search on the graph G_1 starting on vertex...
Graph Question
D Question 1 2 pts Which Graph Algorithm (as described in lecture) relies on a Priority Queue to give it maximum efficiency? Prim's Algorithm ⓔ Dijkstra's Algorithm Kuemmel-Deppeler Algorithm Topological Ordering Algorithm Kruskal's Algorithm D Question 7 2 pts At the beginning of the Dijkstra's Algorithm, which of the following must be done? Select all correct choices. set all total weights to O mark all vertices as unvisited O sort all edges set all predecessors to null
D...
discrete 2
question 31
For Esercises 25.28, write the nodes in a breadth first search of the graph for Exercises 21 the node specified 25、 26, g 20. In the computer network in the accompanying figure, the same message is to be broade Dribe ( 21-24 28. e 27. to nodes 4.Е. F and G. One way to do this is to find the shortest path from C to send out multiple copies of the same message. A more etficient...
The
following graph has been analyzed by a depth-first search. Draw the
resulting depth-first forest.
27. Identify the algorithm that gives the following Information about the structure of a graph Information about the length of paths between ve 28. The following graph has been analyzed by a d Draw the resulting depth-first forest. 3/6 2/9 1/10 B. 1213 7/8 What is the meaning of the notation ".11/16" on node t timestamp earch 28. The following graph has been analyzed by...