Implement RSMs reachability algorithm#7
Implement RSMs reachability algorithm#7Zestria wants to merge 3 commits intoSparseLinearAlgebra:stablefrom
Conversation
| GRB_TRY(GrB_eWiseAdd(P, GrB_NULL, GrB_NULL, GrB_LOR, P, next_frontier, GrB_NULL)); | ||
| GRB_TRY(GrB_Matrix_nvals(&states, next_frontier)); | ||
|
|
||
| if (iteration > 3000) |
| GRB_TRY(GrB_eWiseAdd(K, GrB_NULL, GrB_NULL, GrB_LOR, K, next_frontier, GrB_NULL)); | ||
| GRB_TRY(GrB_Matrix_nvals(&states, next_frontier)); | ||
|
|
||
| if (iteration > 3000) |
| @@ -0,0 +1,333 @@ | |||
| #include <GraphBLAS.h> | |||
There was a problem hiding this comment.
Add tests for graphs, not linear input. e.g.
Graph: 0 -a-> 1; 1 -a-> 2; 2 -a-> 0; 0 -b->3 3 -b-> 0;
Grammar: S -> a S b | a b
Start vertex: 1
Reachable: 0 and 3
Graph: 0 -a-> 0; 0 -a-> 1; 1 -b-> 1
Grammar: S -> a S b | a b
Start vertex: 0
Reachable: 1
Graph: 0 -a-> 0; 0 -b-> 0;
Grammar: S -> a S b | a b
Start vertex: 0
Reachable: 0
Graph: 0 -a-> 0; 0 -c-> 1; 1 -b-> 1;
Grammar: S -> a S b | c
Start vertex: 0
Reachable: 1
Graph: 0 -a-> 1; 1 -a-> 0; 0 -c-> 2; 2 -b->3; 3 -b-> 2;
Grammar: S -> a S b | c
Start vertex: 1
Reachable: 3
Graph: 0 -a-> 1; 1 -a-> 0; 0 -c-> 2; 2 -b->2
Grammar: S -> a S b | c
Start vertex: 1
Reachable: 2
Graph: 0 -a-> 1; 1 -a-> 0; 0 -c-> 2; 2 -b->3; 3-b->4; 4-b->2;
Grammar: S -> a S b | c
Start vertex: 0
Reachable: 2;3;4
Graph: 0 -a-> 1; 1 -a-> 0; 0 -c-> 2; 2 -b->3; 3-b->4; 4-b->2;
Grammar: S -> a S b | c
Start vertex: 1
Reachable: 2;3;4
There was a problem hiding this comment.
Graph: 0 -a-> 1; 1 -a-> 2; 2 -a-> 0; 2 -b->3; 3-b->2; 3-c->4; 4-c->5; 5-c->3; 5-d->2; 2 -d->5;
Grammar (S -- start non-terminal):
S -> X | Y | S X | S Y
X -> a S b | a b
Y -> c S d | c d
Start vertex: 0
Reachable: 2;3;5
This patch implements a context-free path query algorithm using recursive state machines (RSMs) over edge-labeled directed graphs. It extends the approach of the previously unified regular path search algorithm by using linear algebra operations on adjacency matrices, as presented in https://arxiv.org/abs/2412.10287.