Skip to content

Impement advanced CFL reachability algorithm and optimization matrix#5

Open
homka122 wants to merge 161 commits intostablefrom
homka122/CFL_optimizations
Open

Impement advanced CFL reachability algorithm and optimization matrix#5
homka122 wants to merge 161 commits intostablefrom
homka122/CFL_optimizations

Conversation

@homka122
Copy link

@homka122 homka122 commented Nov 5, 2025

Implemented the CFL Reachability algorithm based on Ilya Muravyov’s approach.
Separated and refactored all optimizations into a seperate file.
Added the core algorithm implementation and comprehensive tests with 100% coverage.

@homka122 homka122 force-pushed the homka122/CFL_optimizations branch from 39bd5ee to f1cdd8b Compare March 7, 2026 23:55
@homka122
Copy link
Author

homka122 commented Mar 8, 2026

  • Refactor algorithm
  • Change optimization methods API
  • Now adv algo accept matrices in one unified presentation and modify according to enabled optimizaton
  • 100% test coverage for optimization method and adv algorithm
  • No memory leaks (make memcheck was used for checking)

@homka122 homka122 requested review from gsvgit and spisladqo March 8, 2026 02:18
Copy link
Member

@gsvgit gsvgit left a comment

Choose a reason for hiding this comment

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

Cosmetic.


if (matrix->block_type == VEC_VERT) {
// fix: change to lagraph malloc
GrB_Index *nrows = malloc(matrix->nvals * sizeof(GrB_Index));
Copy link
Member

Choose a reason for hiding this comment

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

Fix.

Matrix *left = swap ? second : first;
Matrix *right = swap ? first : second;

// CFL_matrix_update(first);
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed?

}

if (output != first) {
// fprintf(stderr, "Matrix wise currently support only iadd operation");
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed?


if ((output->block_type == CELL && mask->block_type != CELL) ||
(output->block_type != CELL && mask->block_type == CELL)) {
// fprintf(stderr, "Don't support rsub operation between cell and vector");
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed?

return GrB_SUCCESS;
}

// utility methods
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed?

//------------------------------------------------------------------------------

// Code is based on the "A matrix-based CFPQ algorithm" described in the
// following paper: * Rustam Azimov, Semyon Grigorev, "Context-Free Path
Copy link
Member

Choose a reason for hiding this comment

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

Is advanced version directly based on PhD of Rustam Azimov?

} \
}

#define TRY_I(GrB_method) \
Copy link
Member

Choose a reason for hiding this comment

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

What does I mean?


(*symbols)[(*size)++] = sym;
checked[i] = true;
// printf("Inserted (%ld, %ld, %ld)\n", sym.index, sym.base_index, sym.count);
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed?

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.

3 participants