Repository navigation
fix(hora): expand shared nested edges once per path and meter every row - #107
Merged
Merged
Conversation
EXPAND kept one visited set for the whole traversal, so a hyperedge reached through a second parent was reported as CYCLE. It now tracks the hyperedges on the current path only, so CYCLE means a real cycle. Following every path can repeat a shared hyperedge, so every emitted row and every descent now takes one unit of the row budget, and the traversal stops with one BUDGET_EXHAUSTED row at the first refusal. Before, only descents were counted and rows were unbounded.
Rows at the requested DEPTH were labelled BUDGET_EXHAUSTED, so a client could not tell a complete answer from a cut one. They are now DEPTH_LIMIT; BUDGET_EXHAUSTED is kept for the row budget and for the budget's own depth cap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EXPANDkept one visited set for the whole traversal. A nested hyperedge reached through two parents (a diamond: top contains A and B, both contain C) was expanded under A and then reported asCYCLEunder B, although there is no cycle.Change
CYCLEonly marks a hyperedge that is already an ancestor on that path.EMIT,CYCLE, depth limit) and every descent now takes one unit of the row budget. At the first refusal the traversal stops with a singleBUDGET_EXHAUSTEDrow. Before this change only descents were counted, so one wide hyperedge could emit any number of rows.docs/database/hora.mddescribes the newCYCLEmeaning and the budget rule.LIMIT nonEXPANDnow bounds the number of rows tonplus the one marker row.Tests
DatabaseTest.expandFollowsEveryPathAndStaysWithinItsBudget: diamond (both paths emit the leaf), a real two-edge cycle (CYCLE), a 20-member edge under a budget of 5 (4 rows plus the marker), and 12 stacked diamonds (4096 paths) under a budget of 1000 (at most 1001 rows, one marker).main(CYCLEinstead of the secondEMIT).