Skip to content

Commit

Permalink
implement new incident matrix approach
Browse files Browse the repository at this point in the history
  • Loading branch information
AviAvni committed May 8, 2024
1 parent d6332b1 commit 5ab1b5a
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 140 deletions.
4 changes: 2 additions & 2 deletions src/bulk_insert/bulk_insert.c
Expand Up @@ -272,8 +272,8 @@ static int _BulkInsert_ProcessEdgeFile
// sync matrix once
ASSERT(Graph_GetMatrixPolicy(gc->g) == SYNC_POLICY_RESIZE);
Graph_GetRelationMatrix(gc->g, type_id, false);
Graph_GetSourceRelationMatrix(gc->g, type_id, false);
Graph_GetTargetRelationMatrix(gc->g, type_id, false);
Graph_GetSourceRelationMatrix(gc->g, type_id);
Graph_GetTargetRelationMatrix(gc->g, type_id);
Graph_GetAdjacencyMatrix(gc->g, false);
Graph_SetMatrixPolicy(gc->g, SYNC_POLICY_NOP);

Expand Down
6 changes: 3 additions & 3 deletions src/constraint/constraint.c
Expand Up @@ -527,7 +527,7 @@ void Constraint_EnforceEdges

// fetch relation matrix
ASSERT(Graph_GetMatrixPolicy(g) == SYNC_POLICY_FLUSH_RESIZE);
const Delta_Matrix m = Graph_GetSourceRelationMatrix(g, schema_id, false);
const Delta_Matrix m = Graph_GetSourceRelationMatrix(g, schema_id);
ASSERT(m != NULL);

//----------------------------------------------------------------------
Expand All @@ -538,8 +538,8 @@ void Constraint_EnforceEdges
ASSERT(info == GrB_SUCCESS);

// skip previously enforced edges
while((info = Delta_MatrixTupleIter_next_BOOL(&it, &src_id, &edge_id,
NULL)) == GrB_SUCCESS &&
while((info = Delta_MatrixTupleIter_next_UINT64(&it, &src_id, &edge_id,
&dest_id)) == GrB_SUCCESS &&
src_id == prev_src_id &&
edge_id != prev_edge_id);

Expand Down
4 changes: 2 additions & 2 deletions src/execution_plan/ops/shared/create_functions.c
Expand Up @@ -123,8 +123,8 @@ static void _CommitEdgesBlueprint
// calling Graph_GetRelationMatrix will make sure relationship matrix
// is of the right dimensions
Graph_GetRelationMatrix(g, Schema_GetID(s), false);
Graph_GetSourceRelationMatrix(g, Schema_GetID(s), false);
Graph_GetTargetRelationMatrix(g, Schema_GetID(s), false);
Graph_GetSourceRelationMatrix(g, Schema_GetID(s));
Graph_GetTargetRelationMatrix(g, Schema_GetID(s));
}

// call Graph_GetAdjacencyMatrix will make sure the adjacency matrix
Expand Down
23 changes: 17 additions & 6 deletions src/graph/delta_matrix/delta_matrix.h
Expand Up @@ -112,11 +112,6 @@ Delta_Matrix Delta_Matrix_getTranspose
const Delta_Matrix C
);

bool Delta_Matrix_isDirty
(
const Delta_Matrix C
);

GrB_Matrix Delta_Matrix_M
(
const Delta_Matrix C
Expand Down Expand Up @@ -164,6 +159,14 @@ GrB_Info Delta_Matrix_setElement_BOOL // C (i,j) = x
GrB_Index j // column index
);

GrB_Info Delta_Matrix_setElement_UINT64 // C (i,j) = x
(
Delta_Matrix C, // matrix to modify
uint64_t x, // value
GrB_Index i, // row index
GrB_Index j // column index
);

GrB_Info Delta_Matrix_extractElement_BOOL // x = A(i,j)
(
bool *x, // extracted scalar
Expand All @@ -172,6 +175,14 @@ GrB_Info Delta_Matrix_extractElement_BOOL // x = A(i,j)
GrB_Index j // column index
) ;

GrB_Info Delta_Matrix_extractElement_UINT64 // x = A(i,j)
(
uint64_t *x, // extracted scalar
const Delta_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;

GrB_Info Delta_Matrix_extract_row
(
const Delta_Matrix A, // matrix to extract a vector from
Expand All @@ -180,7 +191,7 @@ GrB_Info Delta_Matrix_extract_row
) ;

// remove entry at position C[i,j]
GrB_Info Delta_Matrix_removeElement_BOOL
GrB_Info Delta_Matrix_removeElement
(
Delta_Matrix C, // matrix to remove entry from
GrB_Index i, // row index
Expand Down
9 changes: 9 additions & 0 deletions src/graph/delta_matrix/delta_matrix_iter.h
Expand Up @@ -73,6 +73,15 @@ GrB_Info Delta_MatrixTupleIter_next_BOOL
bool *val // optional value at A[row, col]
);

// advance iterator
GrB_Info Delta_MatrixTupleIter_next_UINT64
(
Delta_MatrixTupleIter *iter, // iterator to consume
GrB_Index *row, // optional output row index
GrB_Index *col, // optional output column index
uint64_t *val // optional value at A[row, col]
);

// reset iterator
GrB_Info Delta_MatrixTupleIter_reset
(
Expand Down

0 comments on commit 5ab1b5a

Please sign in to comment.