MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / dirpath

Method dirpath

mlspp/src/tree_math.cpp:166–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166std::vector<NodeIndex>
167NodeIndex::dirpath(LeafCount n)
168{
169 if (val >= NodeCount(n).val) {
170 throw InvalidParameterError("Request for dirpath outside of tree");
171 }
172
173 auto d = std::vector<NodeIndex>{};
174
175 auto r = root(n);
176 if (*this == r) {
177 return d;
178 }
179
180 auto p = parent();
181 while (p.val != r.val) {
182 d.push_back(p);
183 p = p.parent();
184 }
185
186 // Include the root except in a one-member tree
187 if (val != r.val) {
188 d.push_back(p);
189 }
190
191 return d;
192}
193
194std::vector<NodeIndex>
195NodeIndex::copath(LeafCount n)

Callers 4

add_leafMethod · 0.80
blank_pathMethod · 0.80
clear_hash_pathMethod · 0.80
getMethod · 0.80

Calls 4

NodeCountClass · 0.85
push_backMethod · 0.80
parentMethod · 0.80

Tested by

no test coverage detected