

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


What are the strongly connected components of the directed graph shown below? (Just circle them.) Note that edges that appear to cross in the figure below are not connected in any way.
What is the stronly connected component that will be discovered first by our algorithm (first do DFS on the reverse graph, then on the graph)? Which one will be discovered last? As always, when DFS has a choice, it visits the alphabetically smallest vertex first.
Label the vertices with their postorder numbers computed by DFS, ie. the order in which they are popped from the stack.
We are running one of these three algorithms on the graph below, where the algorithm has already "processed" the bold-face edges. (Ignore the directions on the edges for Prim's and Kruskal's algorithms.)
CS 170, Spring/1998course, semester/year Midterm #2exam # Professor J. W. Demmelprofessor (e.g., Professor J. Waw 1
Which edge would be added next in Prim's algorithm?
Which edge would be added next in Kruskal's algorithm?
Which vertex would be marked next in Dijkstra's algorithm, i.e. deleted from the top of the heap? Which final edge would Dijkstra's algorithm choose as part of the shortest path to this vertex (i.e. which edge connects to this vertex as part of the shortest path from S)?
Give an efficient algorithm to find the maximum spanning tree in an undirected connected graph, i.e. a spanning tree the sum of whose edge weights is as large as possible. Your solution should consist of a modification of an algorithm you already know. Analyze the complexity of your algorithm, and justify its correctness (if you use an algorithm presented in class, you do not need to rederive its complexity analysis or correctness proof.)
You are given a connected undirected graph.
show that it is possible to direct the edges so that every vetex has in-degree (the number of edges pointing to it) at least 1, if and only if the graph contains a cycle.
Give an efficient algorithm for directing the edges in the manner just described. The algorithm should return FALSE if it is impossible to do so. Analyze the complexity of your algorithm, and justify its correctness (if you use an algorithm presented in class, you do not need to rederive its complexity analysis or correctness proof.)
True or false? No explanation required, except for partial credit. Each correct answer is worth 1 point, but 1 point will be subtracted for each wrong answer, so answer only if you are reasonably certain.
a.An undirected graph in which there is a unique path between every pair of vertices is a tree
Problem #2 (13 points) 2