This preview shows pages 1–2. Sign up to view the full content.
CMPS 101
Midterm 2 Review Problems
Figure 1:
1
2
3
4
5
6
7
8
9
10
11
12
Figure 2:
1
2
3
4
5
6
7
8
9
10
Figure 3:
1
2
3
4
5
6
Problems
1.
Trace BFS on the following graphs.
For each vertex, record its color, parent, and distance fields, and
draw the resulting BFS tree.
Process adjacency lists in (ascending) numerical order.
a.
The graph in figure 1, with 1 as the source.
b.
The directed graph in figure 2 with 1 as source.
2.
Trace DFS on the following graphs.
For each vertex, record its color, parent, discover, and finish fields,
and draw the resulting DFS forest.
Classify each edge as tree, back forward, or cross.
Process adjacency
lists in (ascending) numerical order.
a.
The graph in figure 1.
Process vertices in the main loop of DFS in (ascending) numerical order.
b.
The graph in figure 2.
Process vertices in the main loop of DFS in (ascending) numerical order.
c.
The transpose of the graph in figure 2.
Process vertices in the main loop of DFS in order of
descending finish times from part b.
Determine the strongly connected components of the graph in
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '09
 AgoreBack

Click to edit the document details