Skip to content

Implement RSMs reachability algorithm#7

Open
Zestria wants to merge 12 commits intoSparseLinearAlgebra:stablefrom
Zestria:feat/rsm-reach
Open

Implement RSMs reachability algorithm#7
Zestria wants to merge 12 commits intoSparseLinearAlgebra:stablefrom
Zestria:feat/rsm-reach

Conversation

@Zestria
Copy link
Copy Markdown

@Zestria Zestria commented Dec 3, 2025

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.

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

Comment thread experimental/test/test_RSM_reachability.c Outdated
@Zestria
Copy link
Copy Markdown
Author

Zestria commented Apr 17, 2026

cfpq_algo.md

Zestria added 6 commits April 17, 2026 22:48
Matrix reshape from |V|*|V| to 1*|V*V| triggered 32-bit indexing
overflow when V*V > 2^32. The library correctly detects potential
overflow (Cj_is_32=false), but the in-place reshape operation
(in_place=true) inherits T->j_is_32=true from the original matrix,
causing J_work_is_32 to become true and overflow to occur.

Solution: use matrix_reshape_dup instead of matrix_reshape to create
a new matrix (in_place=false), so J_work_is_32 correctly evaluates
to false and 64-bit indexing is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants