MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / pre_order

Function pre_order

cp-profiler/src/cpprofiler/utils/tree_utils.cpp:122–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122std::vector<NodeID> pre_order(const NodeTree &tree)
123{
124 std::stack<NodeID> stk;
125 std::vector<NodeID> result;
126
127 NodeID root = NodeID{0};
128
129 stk.push(root);
130
131 while (stk.size() > 0)
132 {
133 auto nid = stk.top();
134 stk.pop();
135 result.push_back(nid);
136
137 for (auto i = tree.childrenCount(nid) - 1; i >= 0; --i)
138 {
139 auto child = tree.getChild(nid, i);
140 stk.push(child);
141 }
142 }
143
144 return result;
145}
146
147std::vector<NodeID> any_order(const NodeTree &tree)
148{

Callers 2

save_nodesFunction · 0.85
saveSearchMethod · 0.85

Calls 4

topMethod · 0.80
sizeMethod · 0.45
childrenCountMethod · 0.45
getChildMethod · 0.45

Tested by

no test coverage detected