Add BFS to set dag node levels.