Not very elegant, but maybe something like this? type MyNode level::Int nLeafs::Int leafs::Vector{MyNode} end
MyNode() = MyNode(0,0,MyNode[]) N = 100 root = MyNode(0,N, [MyNode() for i in 1:N]) then you can go on and define the 1st level with a for loop and so on. Because it is only 3 levels I guess you can manually set it up, otherwise you want to use recursive functions or so. For 2nd level: for node in root.leafs do_whatever end