Open
Conversation
Collaborator
Author
|
Hello @suvorovrain and @georgiy-belyanin can you look at this please |
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 PR introduces a flexible abstraction for evaluating Regular Path Queries (RPQs) over edge-labeled graphs and provides a concrete implementation using
LAGraph_RegularPathQueryfunction. We add RPQ_Evaluator trait and implement it with algo mentioned above. We transformation from parser output PropertyPathExpression which is regexp of WHERE clause to NFA using thomposon's construction algorithm. The NFA constructoin is heavily vibe-coded. Sparql parser is cherry-picked from its branch.NFA Construction via Thompson's Algorithm
The evaluator converts SPARQL property paths into NFAs using Thompson's construction:
a/b): Connects NFAs by merging the final state of the first with the start state of the seconda|b): Creates a new start state with ε-transitions to both sub-NFAs, and a new final state with ε-transitions from botha*): Adds ε-transitions from start→final (zero iterations) and final→start (repetition)a+): Similar to star but without the zero-iteration bypassa?): Adds a direct ε-transition from start to finalε-Elimination
After construction, the NFA contains ε-transitions that must be eliminated before GraphBLAS evaluation:
Matrix Preparation
For each unique label in the NFA:
(from_state, to_state, 1)LAGraph_Graphrepresenting the NFA's transition structure for that label