Stores level of each node from root
level [ node ] = h NEW_LINE for child in graph [ node ] : NEW_LINE INDENT if ( child == parent ) : NEW_LINE INDENT continue NEW_LINE DEDENT dfs ( child , node , h + 1 ) NEW_LINE DEDENT