I think you also need to collect the depth. This is what you would actually do if you had a recursive version. It is just that the repository will be βinvisibleβ, since you would use the call stack instead of the explicit stack, as you are doing now.
If this helps you, you can easily convert a depth search to a width search, using the array as a queue instead of a stack. (Just remove FirstObject instead of removeLastObject.) Then you should know that you always look at nodes in order of non-decreasing depth. However, if you need accurate depths, I think you still need to add storage to keep track of when you need to increase your current depth.
Update:
You should be able to do DFS without a stack at all, if instead you follow the parent's pointers from node to back up the tree. This would make maintaining depth easier. But you have to be careful not to disturb the complexity of the worst case with linear time, retelling the children to find out where you were.
If you do not have parent pointers, you should be able to collect enough information to track your parents. But that would mean that you are adding more information about the stack than you are currently doing, so this will not be a big improvement over laying the depths directly.
By the way, looking carefully at your algorithm, don't you look at the wrong side of the array when you get the next current node? It should work as follows:
push root while stack not empty: current = pop push all children of current
source share