| 24 | } |
| 25 | |
| 26 | NodeID Structure::createRoot(int kids) |
| 27 | { |
| 28 | if (nodes_.size() > 0) |
| 29 | { |
| 30 | throw invalid_tree(); |
| 31 | } |
| 32 | |
| 33 | const auto root_nid = createNode(NodeID::NoNode, kids); |
| 34 | |
| 35 | /// create white nodes for children nodes |
| 36 | for (auto i = 0; i < kids; ++i) |
| 37 | { |
| 38 | createChild(root_nid, i, 0); |
| 39 | } |
| 40 | |
| 41 | return root_nid; |
| 42 | } |
| 43 | |
| 44 | NodeID Structure::createNode(NodeID pid, int kids) |
| 45 | { |