map_bfs_back function

Apply a function to nodes in the reverse order of a breath first search