CS 457, Data Structures and Algorithms I Fifth Problem Set November 17, 2020 Due on November 25. Collaboration is not allowed. Contact Xizhi and me for questions. For any algorithms that you propose,...

1 answer below »
CS 457, Data Structures and Algorithms I Fifth Problem Set November 17, 2020 Due on November 25. Collaboration is not allowed. Contact Xizhi and me for questions. For any algorithms that you propose, also provide a (high level) justification regarding their worst-case running time bounds, and a brief explanation regarding their correctness. 1. (25 pts) Consider a variation of the Strongly-Connected-Components(G) (see Page 617 of your textbook) which, rather than calling DFS(GT ) in Step 3, calls DFS(G) instead (everything else remains the same). Provide a graph G = (V, E) for which this variation is incorrect, i.e., it does not output the correct set of strongly connected components of G. For full credit, explain what the variation of the algorithm would do for this graph G: i) provide v.d and v.f for all v ∈ V for Step 1 (you can choose the initial ordering of the vertices), ii) provide v.d and v.f for all v ∈ V for Step 3, iii) provide the set of connected components that it would output, and iv) explain why this output is incorrect. 2. (25 pts) Provide an algorithm that, given a directed acyclic graph G = (V, E) and two vertices s, t ∈ V , returns the number of simple paths from s to t in G. Your algorithm’s worst-case running time should be O(m + n). 3. (25 pts) An Eulerian tour of a strongly connected directed graph G = (V, E) is a directed cycle that contains every edge in E exactly once (at least once and no more than once). First, prove that G has an Eulerian tour if and only if every vertex in V has its in-degree equal to its out-degree. Then, using this fact, provide a O(m) algorithm that returns an Eulerian tour of G, if one exists, or reports that no Eulerian tour exists. Hint: your algorithm can merge edge-disjoint cycles. 4. (25 pts) Provide a DFS-based algorithm that takes as input a graph G = (V, E) and determines if there exists an edge e ∈ E such that removing e from E increases the number of connected components of G. If such an edge exists, your algorithm should return all of the edges in E with this property. For instance, if V = {v1, v2, v3} and E = {(v1, v2),(v2, v3)}, then G = (V, E) has a single connected component. Removing either one of the two edges in E would increase the connected components from one to two, so the algorithm should return both of these edges in this example. The worst-case running time of the algorithm should be O(m + n).
Answered Same DayNov 18, 2021

Answer To: CS 457, Data Structures and Algorithms I Fifth Problem Set November 17, 2020 Due on November 25....

Ayush answered on Nov 23 2021
158 Votes
Solutions
Ans 1- This suggestion will not succeed.
Proof :- Consider an example, suppose that the graph
has three vertices {1, 2, 3} and consists of the edges (2, 1),(2, 3),(3, 2). Then our strongly connected components would be {2,3} and {1}.Though, if we perform a depth first search starting at the vertex 2 it would visit vertex 3 before vertex 1. This implies that the finishing time of vertex 3 is lower than that of vertex 1 and 2. This means that if we perform the depth first search starting at vertex 3, we would be able to reach all the other vertices. This means that the algorithm would return a wrong output i.e the entire graph is a single strongly connected component, even though it is not as there is neither a path from 1 to 3 nor from 1 to 2.
Ans 2-
Start:
Def paths(s,t)
if s == t then
return 1
else if s.paths != NIL then
Return s.paths
else
for each v ∈ Adj[u] do
s.paths = s.paths+ SIMPLE-PATHS(v, t)
end for
Return s.paths
end if
Ans 3. An Eulerian circuit of a strongly connected directed graph G=(V,E) is a directed cycle that...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here