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.
resultList | noIncoming | remainingEdges |
[] | [6 0 ] | [1 2 3 4 5] |
[6] | [0] | [1 2 3 4 5] |
[6 0] | [1 ] | [2 3 4 5] |
[6 0 1] | [2 5] | [3 4] |
[6 0 1 2] | [5 ] | [3 4] |
[6 0 1 2 5] | [3 4] | [] |
[6 0 1 2 5 3] | [4] | [] |
[6 0 1 2 5 3 4] | [] | [] |
Topological Sorted Order is [6 0 1 2 5 3 4]
please up vote
Apply the topological sort algorithm to the graph. Follow the algorithm in you textbook and clearly...
(A) Consider the following algorithm for computing a topological sort of a DAG G: add the vertices to an initially empty list in non-decreasing order of their indegrees. Either argue that the algorithm correctly computes a topological sort of G, or provide an example on which the algorithm fails. (B) Can the number of strongly connected components of a graph decrease if a new edge is added? Why or why not? Can it increase? Why or why not? (C) What...
3. Apply Topological sort algorithm on the following graph. Then, draw the sorted graph. 11 marvel
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...
The weights of edges in a graph are shown in the table above. Apply the sorted edges algorithm to the graph. Give your answer as a list of vertices, starting and ending at vertex A. Example: ABCDEFA
2. Is the topological sort in
the Cormen textbook fig 22.7 unique? Are there other ways of
sorting? Explain why or why not considering the DFS approach.
613 22.4 Topological sort 11/16 undershorts socks) 17/18 watch 9/10 shoes 13/14 1215 Pants shirt 1/8 6/7 (belt (a) tie 2/5 jacket 3/4 (b) socks (undershorts ants shoes (watch (shirt belt tie acket 12/15 13/14 9/10 1/8 3/4 Figure 22.7 (a Professor Bumstead topologically sorts his clothing when getting dressed. Each directed edge...
Run Dijkstra's algorithm on the graph G below, where s is the source vertex. Draw a table that shows the vertices in Q at each iteration. Write thed and I values of each vertex. Color the edges in the shortest-path tree, similar to the example from the notes. List the order in which vertices are added to S. Use the algorithm learned in class.
Run the Dijkstra’s algorithm on the directed graph of the
following figure 24.6, using vertex t as
the source. In the style of Figure 24.6, show the d and
? values and the vertices in set S after each iteration of
the while loop.
1 8 10 I 10 14 4 6 4 6 2 3 2 3 4 6 5 5 2 (a) (c) 1 10 13 4 6 (d) (e) Figure 24.6 The execution of Dijkstra's algorithm. The...
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...
Consider the following weighted, directed graph G. There are 7 vertices and 10 edges. The edge list E is as follows:The Bellman-Ford algorithm makes |V|-1 = 7-1 = 6 passes through the edge list E. Each pass relaxes the edges in the order they appear in the edge list. As with Dijkstra's algorithm, we record the current best known cost D[V] to reach each vertex V from the start vertex S. Initially D[A]=0 and D[V]=+oo for all the other vertices...