312: def depth_first_visit (u, vis = DFSVisitor.new(self), &b)
313: vis.color_map[u] = :GRAY
314: vis.handle_examine_vertex(u)
315: each_adjacent(u) { |v|
316: vis.handle_examine_edge(u, v)
317: if vis.follow_edge?(u, v)
318: vis.handle_tree_edge(u, v)
319: vis.color_map[v] = :GRAY
320: depth_first_visit(v, vis, &b)
321: else
322: if vis.color_map[v] == :GRAY
323: vis.handle_back_edge(u, v)
324: else
325: vis.handle_forward_edge(u, v)
326: end
327: end
328: }
329: vis.color_map[u] = :BLACK
330: vis.handle_finish_vertex(u)
331: b.call(u)
332: end