Skip to content

add rpq-matrix algo to export branch for pathrex#14

Merged
suvorovrain merged 38 commits into
pathrex-exportfrom
rain/rpq-matrix-cardinality
Jul 19, 2026
Merged

add rpq-matrix algo to export branch for pathrex#14
suvorovrain merged 38 commits into
pathrex-exportfrom
rain/rpq-matrix-cardinality

Conversation

@suvorovrain

@suvorovrain suvorovrain commented Jul 19, 2026

Copy link
Copy Markdown

collecting all algorithms that should be used in pathrex project in one branch.

  • default larpq (already in lagraph
  • rpqmatrix (this pr)
  • larpq with paths (todo)
  • mmread fix (this pr)

Solver logic was moved out main public function.
Also this patch adds input validation.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
This patch add documentation with explaining
of RPQ-matrix algorithm work.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
Remove unused label function and old logic from check function.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
In previous versions there was a logic mistakes in
processing of L and R kleene stars. Now they are
correct. Also provide a docs.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
In this patch all kleene stars was slightly changed
- Identity matrix name changes from E to I
- All tmp matrices T was demolished
- R kleene logic changed from
	S <- A
	T <- S x B
	S <- S + T
 to
	S <- A
	S <- S x (B + I)
- L kleene logic changed in the same way

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
Add spaces before ; and add docs for struct in include.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
This patch fixes typo in the name of RPQ-matrix
main function. Correct in include and algorithm
directories.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
This patch fixes incorrect assertions in check and in main
functions. Also some refactor

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
In previous commit about kleene logic I
start use result matrix S as input and
output. I guess this leads to UB. So i
come back to tmp matrices.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
This patch adds tests for valid and
invalid input.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
This patch brings old kleene logic back:
- R kleene:
	S <- A
	S <- S x (B + I)
- L kleene:
	S <- B
	S <- (A + I) x S
Also all kleene stars now implemented via
accumulator without creation new tmp
matrices.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
This patch brings public methods for rust la-n-egg-rpq algorithm.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
suvorovrain and others added 8 commits October 8, 2025 21:29
Fix the typo in non null assertion. we
should check res_mat ofc.

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
This patch fixes the wrong assertion in the regex evaluator that made it
impossible to have repeated subexpressions. Assume `(a|b)/(a|b)` regex
as an example. This RE have two repeated subexpressions `(a|b)`. The
e-graph logic would take into account the fact that these expressions
are the same and the resulting tree of the regular expression would have
the same node for the `(a|b)` expression.

Let's get into the problem. Before this patch the LAGraph solver
evaluated lhs, rhs first and then combined their results w.r.t. node
type. If there were repeated subexpressions the solver failed due to
the assertion that every subexpression had not been evaluated yet. This
happened to the example: we evaluated LHS `(a|b)` at first and then we
try to calculate RHS `(a|b)`. But the corresponding subtree is already
calculated and the assertion is fired. Let's remove the wrong assertion
and fix the problem.

Apart from these fixes, this patch improves error messages. It has been
done in terms of determining what is wrong. There is no reason to avoid
these improvements.
this patch brings reduce method that allows
calculate reduced matrix by rows and column
in lanegg

Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
Signed-off-by: Rodion Suvorov <rodion.suvorov.94@mail.ru>
@suvorovrain
suvorovrain merged commit 862641d into pathrex-export Jul 19, 2026
6 of 8 checks passed
@suvorovrain

Copy link
Copy Markdown
Author

build failed due to upstream errors

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