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

Function nodes_below

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

Source from the content-addressed store, hash-verified

40}
41
42std::vector<NodeID> nodes_below(const tree::NodeTree &nt, NodeID nid)
43{
44
45 if (nid == NodeID::NoNode)
46 {
47 throw std::exception();
48 }
49
50 std::vector<NodeID> nodes;
51
52 std::stack<NodeID> stk;
53
54 stk.push(nid);
55
56 while (!stk.empty())
57 {
58 const auto n = stk.top();
59 stk.pop();
60 nodes.push_back(n);
61
62 const auto kids = nt.childrenCount(n);
63 for (auto alt = 0; alt < kids; ++alt)
64 {
65 stk.push(nt.getChild(n, alt));
66 }
67 }
68
69 return nodes;
70}
71
72void apply_below(const NodeTree &nt, NodeID nid, const NodeAction &action)
73{

Callers 2

apply_belowFunction · 0.85
showNogoodsMethod · 0.85

Calls 3

topMethod · 0.80
childrenCountMethod · 0.45
getChildMethod · 0.45

Tested by

no test coverage detected