# Run depthrst search on the graph reproduced below

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: same destination, you decide to use the edge classiﬁcation of depth-ﬁrst search. Run depthﬁrst search on the graph reproduced below, starting from vertex A, and label every edge with T if it’s a tree edge, B if it’s a back edge, F if it’s a forward edge, and C if it’s a cross edge. As a reminder, recall that an edge (u, v ) is • a tree edge (T) if v was ﬁrst discovered by exploring edge (u, v ) (tree edges form the depth-ﬁrst forest); • a back edge (B) if v is u’s ancestor in a depth-ﬁrst tree; • a forward edge (F) if v is u’s descendant in a depth-ﬁrst tree; and • a cross edge (C) if none of the above apply. Solution: Recursion-based implementation: D B B T B T B A F T T T T C E T G H B Stack-based implementation: D T T B B B A T F T B T B C E T G T H Scoring: For Problem 3(c) and 3(d), we computed the score as P − 1 Nw , where 2 P is the total points of the problem and Nw is the number of wrong labels. 6.006 Quiz 2 Solutions Name 6 (d) [6 points] Now suppose that the passages in the maze...
View Full Document

## This document was uploaded on 03/17/2014 for the course ELECTRICAL 6.006 at MIT.

Ask a homework question - tutors are online