A chain of nodes linked by forward links is considered one node with many left and right children for depth measuring here and in TVanEmdeBoasReverseNodeEnumerator::FindDescendants.
| 249 | // for depth measuring here and in |
| 250 | // TVanEmdeBoasReverseNodeEnumerator::FindDescendants. |
| 251 | size_t TTrieMeasurer::MeasureSubtrie(size_t rootOffset, bool isNewPath) { |
| 252 | Y_ASSERT(rootOffset < Trie.Length); |
| 253 | TNode node(Trie.Data, rootOffset, Trie.SkipFunction); |
| 254 | size_t depth = 0; |
| 255 | for (;;) { |
| 256 | ++UnminimizedNodeCount; |
| 257 | if (Verbose) { |
| 258 | ShowProgress(UnminimizedNodeCount); |
| 259 | } |
| 260 | if (isNewPath) { |
| 261 | if (ParentCounts.Get(node.GetOffset()) > 0) { |
| 262 | isNewPath = false; |
| 263 | } else { |
| 264 | ++NodeCount; |
| 265 | } |
| 266 | ParentCounts.Inc(node.GetOffset()); |
| 267 | } |
| 268 | if (node.GetLeftOffset()) { |
| 269 | depth = Max(depth, 1 + MeasureSubtrie(node.GetLeftOffset(), isNewPath)); |
| 270 | } |
| 271 | if (node.GetRightOffset()) { |
| 272 | depth = Max(depth, 1 + MeasureSubtrie(node.GetRightOffset(), isNewPath)); |
| 273 | } |
| 274 | if (node.GetForwardOffset()) { |
| 275 | node = TNode(Trie.Data, node.GetForwardOffset(), Trie.SkipFunction); |
| 276 | } else { |
| 277 | break; |
| 278 | } |
| 279 | } |
| 280 | return depth; |
| 281 | } |
| 282 | |
| 283 | //-------------------------------------------------------------------------------------- |
| 284 |
nothing calls this directly
no test coverage detected