-
Notifications
You must be signed in to change notification settings - Fork 76
Add Context-Free Path Query Algorithm for the Reachability Problem #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Context-Free Path Query Algorithm for the Reachability Problem #265
Conversation
Build can fail due to missing mallopt function in musl. Upstreaming the fix would eliminate the patch from the LAGraph JLL package build ([see pull request](JuliaPackaging/Yggdrasil#7089))
`#ifdef __GLIBC__` for musl compatibility
remove GxB_SelectOp
Because there are free macros in Lagraph headers, so we don't want to override them
This is done for preserve ISO status of the matrices
indexes array, identity matrix and true scalar has not been freed
|
Thanks for the contribution! The stable branch is one we rarely change though -- only after it undergoes a deeper review and documentation, version change, and so on. Can you move the pull request to the v1.2 branch? |
DrTimothyAldenDavis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
|
@DrTimothyAldenDavis Ready! |
|
I see a lot of minor conflicts with the v1.2 branch though. Can you resolve those first? It looks like most of them should stay unmodified in the v1.2 branch. Sorry for the hassle. |
|
@DrTimothyAldenDavis Sure! |
|
@DrTimothyAldenDavis Hi! I resolved all conflicts. |
|
I've been working on getting LAGraph v1.2 version polished, with the goal of a stable version release. I have the test coverage up to nearly 100%, but there are a few lines in the CFL method that aren't tested by the tests in test_CFL_reachability.c. I've tagged the untested lines of code in LAGraph_CFL_reachability.c with FIXMEs. Can you take a look? |
Hi @DrTimothyAldenDavis. I’ve updated the code and test coverage is now at 100%! |

Implementation of Context-Free Path Query Algorithm
This pull request adds an implementation of the Context-Free Path Query algorithm for solving the reachability problem using linear algebra. This algorithm was presented in the work available at this link.
Overview
The algorithm takes as input an edge-labeled graph and a context-free grammar, and it outputs all pairs of vertices between which there is at least one path such that the concatenation of edge labels forms a word in the language generated by the grammar.
Inputs
Output
The algorithm produces a set of matrices, each corresponding to a non-terminal of the grammar. For example, in the matrix
A[k], the entryA[k][i, j]is 1 if and only if there is a path from nodeito nodejwhose edge labels form a word derivable from the non-terminalkof the CFG.Additional Details
A new structure has been added to represent a rule of the context-free grammar in Weak Chomsky Normal Form.
For a full description of the algorithm, please refer to the original document.