Run depthrst search on the graph reproduced below

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

View Full Document Right Arrow Icon
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 classification of depth-first search. Run depthfirst 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 first discovered by exploring edge (u, v ) (tree edges form the depth-first forest); • a back edge (B) if v is u’s ancestor in a depth-first tree; • a forward edge (F) if v is u’s descendant in a depth-first 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