function depth_first(place):

 if place is already visited:
 return
 mark place visited
 visit(place)
 for neighbor in place.neighbors:
 depth_first(neighbor)
