Question

Q6: 20 pts) For the directed graph assigned to you
Q6: 20 pts) For the directed graph assigned to you
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Depth first Search algorithm works with Stack mechanism.

1) Node 1, is pushed into the stack and then selecting any arbitrary node(2,5). If node 2 is selected then node2 will be pushed into the Stack. And then there is only one directed unvisted node(5).

1-->2-->5

From node 5, there is no way to visit the unvisited nodes.

3 2. 1. 1 4t 1254-3 esa n e a, is dou b

Now we will be backtracking(pop operation) to node 2. From node 2, there is no possible way to visit the unvisited nodes.

Again from node 2, we will be backtracking(pop operation) to node 1. From node 1, it will search for possible ways to unvisited nodes.Yes,from node 1,there is way to node 4(which is unvisited node).

1-->4-->3

From node 4, there is way to node 3(unvisited).

From node 3, it will search for other directed node(2). But node 2 is already visited. Now all the nodes are visited.

Add a comment
Know the answer?
Add Answer to:
Q6: 20 pts) For the directed graph assigned to you, run the Depth First Search algorithm....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Student Name: Q5-15 pts) Run the Depth First Search algorithm on the following directed acyclic graph...

    Student Name: Q5-15 pts) Run the Depth First Search algorithm on the following directed acyclic graph (DAG) and determine a topological sort of the vertices as well as identify the tree edges, forward edges and cross edges 3 5 0 2 4 7

  • Name J#: Q7:20 pts) Conduct a Depth First Search (DFS) on the graph assigned to you....

    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

  • Consider the following directed graph for each of the problems: 1. Perform a breadth-first search on...

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

  • Apply the topological sort algorithm to the graph. Follow the algorithm in you textbook and clearly...

    Apply the topological sort algorithm to the graph. Follow the algorithm in you textbook and clearly show the content of the three lists: resultList, noIncoming and remainingEdges after each iteration. 2. Apply the topological sort algorithm to the graph below. Follow the algorithm in you textbook and clearly show the content of the three lists: resultList, nolncoming and remainingEdges after each iteration GraphTopologicalSort (graph) { resultList = empty list of vertices no Incoming = list of all vertices with no...

  • You will be implementing a Breadth-First Search (BFS) and a Depth-First Search (DFS) algorithm on a...

    You will be implementing a Breadth-First Search (BFS) and a Depth-First Search (DFS) algorithm on a graph stored as an adjacency list. The AdjacencyList class inherits from the Graph class shown below. class Graph { private: vector _distances; vector _previous; public: Graph() { } virtual int vertices() const = 0; virtual int edges() const = 0; virtual int distance(int) const = 0; virtual void bfs(int) const = 0; virtual void dfs(int) const = 0; virtual void display() const = 0;...

  • Show the operation of depth-first search (DFS) on the graph of Figure 1 starting from vertex...

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

  • 3.3. Run the DFS-based topological ordering algorithm on the following graph. Whenever you have a...

    3.3. Run the DFS-based topological ordering algorithm on the following graph. Whenever you have a choice of vertices to explore, always pick the one that is alphabetically first. (a) Indicate the pre and post numbers of the nodes. (b) What are the sources and sinks of the graph? (c) What topological ordering is found by the algorithm? (d) How many topological orderings does this graph have? 3.3. Run the DFS-based topological ordering algorithm on the following graph. Whenever you have...

  • Implement the depth-first search (DFS) algorithm. To make your algorithm complete, write the graph search version...

    Implement the depth-first search (DFS) algorithm. To make your algorithm complete, write the graph search version of DFS, which avoids expanding any already visited states. Your code should quickly find a solution for tinyMaze.txt (below) %%%%%%% % S% % %%% % % % % %% %% %F %%%% %%%%%%%

  • 3. Given a directed graph G < V E >, we define its transpose Gr < V.E1 > to be the graph such tha...

    3. Given a directed graph G < V E >, we define its transpose Gr < V.E1 > to be the graph such that ET-{ < v, u >:< u, v >EE). In other words, GT has the same number of edges as in G, but the directions of the edges are reversed. Draw the transpose of the following graph: ta Perform DFS on the original graph G, and write down the start and finish times for each vertex in...

  • 03:25 pts) For the edge weight matrix assigned to you for a directed graph, determine the...

    03:25 pts) For the edge weight matrix assigned to you for a directed graph, determine the shortest path weights between any two vertices of the graph using the Floyd-Warshall algorithm. Show clearly the distance matrix and the predecessor matrix for each iteration Also, extract a path of length two or above between any two vertices of your choice. Clearly show the path extraction steps, as shown in the slides. V1 V1 9 V2 0 V3 3 w 85 V2 V3...

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
ADVERTISEMENT