USACO Treedepth without genfunc?

So I remember attempting (and failing) Treedepth last year and then hearing that the full solution required generating functions. Recently though, Mostafa gave me Treedepth again and told me to solve it using DP.

Does anyone have any idea how to do this? I have no idea how to approach this problem.

I don’t know of a solution that is significantly different from the one presented in the analysis, if that’s what you mean by “without genfunc.”