walk a directed acyclic graph