Skip to content

Commit f0b8b6a

Browse files
committed
feat: add label and destroy methods
This patch brings public methods for rust la-n-egg-rpq algorithm. Signed-off-by: Rodion Suvorov <[email protected]>
1 parent 1c08178 commit f0b8b6a

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

experimental/algorithm/LAGraph_RPQMatrix.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,35 @@ GrB_Info LAGraph_RPQMatrix_check(RPQMatrixPlan *plan, GrB_Index *dimension, char
167167
static GrB_Semiring sr ;
168168
static GrB_Monoid op ;
169169

170+
GrB_Info LAGraph_RPQMatrix_label(GrB_Matrix *mat, GrB_Index x, GrB_Index i, GrB_Index j)
171+
{
172+
OK(GrB_Matrix_new(mat, GrB_BOOL, i, j)) ;
173+
OK(GrB_Matrix_setElement(*mat, true, x, x)) ;
174+
return (GrB_SUCCESS) ;
175+
}
176+
GrB_Info LAGraph_DestroyRpqMatrixPlan(RPQMatrixPlan *plan)
177+
{
178+
if (plan == NULL)
179+
{
180+
return GrB_SUCCESS
181+
}
182+
if (plan->mat != NULL)
183+
{
184+
OK(GrB_Matrix_free(plan->mat)) ;
185+
}
186+
if (plan->res_mat != NULL)
187+
{
188+
OK(GrB_Matrix_free(plan->res_mat)) ;
189+
}
190+
GrB_Info lstatus = LAGraph_DestroyRpqMatrixPlan(plan->lhs) ;
191+
GrB_Info rstatus = LAGraph_DestroyRpqMatrixPlan(plan->rhs) ;
192+
if (rstatus || lstatus)
193+
{
194+
return GrB_INVALID_VALUE ;
195+
}
196+
return GrB_SUCCESS ;
197+
} ;
198+
170199
GrB_Info LAGraph_RPQMatrix_solver(RPQMatrixPlan *plan, char *msg) ;
171200

172201
static GrB_Info LAGraph_RPQMatrixLor(RPQMatrixPlan *plan, char *msg)

include/LAGraphX.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,18 @@ GrB_Info LAGraph_RPQMatrix(
962962
char *msg // LAGraph output message
963963
) ;
964964

965+
LAGRAPHX_PUBLIC
966+
GrB_Info LAGraph_RPQMatrix_label
967+
(
968+
GrB_Matrix *mat,
969+
GrB_Index x,
970+
GrB_Index i,
971+
GrB_Index j
972+
) ;
973+
974+
LAGRAPHX_PUBLIC
975+
GrB_Info LAGraph_DestroyRpqMatrixPlan(RPQMatrixPlan *plan) ;
976+
965977
//****************************************************************************
966978
LAGRAPHX_PUBLIC
967979
int LAGraph_VertexCentrality_Triangle // vertex triangle-centrality

0 commit comments

Comments
 (0)