Repository navigation
feat(retrieval): MOTIFS census, profiles and occurrence search - #121
Merged
Merged
Conversation
MOTIFS counts triples of overlapping hyperedges by h-motif class, over one hyperedge type or all of them: exactly, from a uniform sample of hyperedges with a standard error, or exactly with a fallback to sampling when the budget runs out. There are 30 classes, the 26 of Lee, Ko and Shin plus four for hyperedges with equal member sets. MOTIF PROFILE counts the classes around one hyperedge. MOTIF <code> lists the triples of one class with positions, optional types per position, an anchor hyperedge, region conditions on a member's type, identity and roles, nesting, and ranking by the triplet weights of Niu et al. Neighbourhoods and overlaps come from the reverse index at query time; nothing is added to the write path. A census can also be kept as a view, CREATE VIEW v AS MOTIFS [OF Type], rebuilt on refresh. Only the reader's hyperedges and visible members count. No issue tracks this work.
Postings of a hub are now charged every 1,024 reads instead of after the whole walk, and the holders of a fixed region member are charged too. The automatic count decides between exact and sampled by rows alone, and a pilot run with another seed fixes the number of draws, so the same query on the same data gives the same answer however busy the machine is. A motif census view cannot be CONTINUOUS, and a refresh rebuilds it only when the tenant's memberships changed. SEED is refused with EXACT, a fixed region member is tested directly, and the ROLES order is documented. No issue tracks this work.
This was referenced Nov 23, 2026
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.
This adds hypergraph motif counting. Three hyperedges that overlap form one of 30 shapes ("classes"). This PR adds statements that count how often each shape occurs, count the shapes around one hyperedge, and list the triples of one shape with conditions on who sits where. The model is the h-motif of Lee, Ko and Shin (PVLDB 2020). Their 26 classes are extended with 4 more for hyperedges that have the same members, since two meetings with the same attendees are ordinary data here.
The syntax is open for renaming before merge.
docs/database/motifs.mdexplains the classes, regions and weights.How it works
MOTIFS EXACTis the paper's exact algorithm.SAMPLE ndrawsnhyperedges uniformly and reports an unbiased estimate with a standard error.MOTIF <code>returns each triple once. Results can be narrowed by types per position, an anchor hyperedge, or conditions on a region's member (a fixed atom, a type, roles per hyperedge), and filtered for nesting.RANK BYuses the triplet weights of Niu et al. (IEEE BigData 2024).Testing
MotifTestagainst a brute force that enumerates every triple and classifies it independently:MotifStatementTest: the design's worked example end to end, including the census view after a member is added (classes 94/31/30 become 95/31/31/53), and every invalid form.SecurityTest#motifsStayInsideTheTenantplants cross-tenant memberships both ways. Without the member filter the test fails.HYPERMATCHcounts andBRANCH DELTAagree.DIFFUSE,EXPAND FROM,SELECT EVIDENCE,REFINEandMOTIFwere identical after a SIGKILL and recovery (350 commits replayed).Independent review. No critical issues. The three important ones are fixed:
Not done here
Roles,Region,Nested,Rank,LimitorAroundcannot followHAS ANY.