For the concept of layers I use multiple root nodes. Assuming your graph is set up so that draw(node) traverses the node's tree drawing each child node from the bottom up, then drawing multiple root nodes one after each other effectively draws in layers. For example:
std::array<Node, 4u> layers;
for(const auto& layer : layers)
{
draw(layer);
}
Each of these is a root node, so layers[0] draws all its children, followed by layers[1] and so on. If it helps you can label them with an enum:
enum LayerID
{
Back = 0,
Middle,
Front,
UI
}
layers[LayerID::UI].addChild(myUINode);
I have a practical example of it here (https://github.com/fallahn/xygine/blob/master/xygine/include/xygine/Scene.hpp#L59).