Skip to content

Commit ab43da4

Browse files
Merge pull request #355 from GraphBLAS/with_GraphBLAS_v10
maxflow: for GrB 10.0.0 or later
2 parents 6061b88 + 4d9481e commit ab43da4

File tree

6 files changed

+49
-4
lines changed

6 files changed

+49
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
cmake_minimum_required ( VERSION 3.20 ) # LAGraph can be built stand-alone
4040

4141
# version of LAGraph
42-
set ( LAGraph_DATE "June 1, 2025" )
42+
set ( LAGraph_DATE "July 25, 2025" )
4343
set ( LAGraph_VERSION_MAJOR 1 CACHE STRING "" FORCE )
4444
set ( LAGraph_VERSION_MINOR 2 CACHE STRING "" FORCE )
4545
set ( LAGraph_VERSION_SUB 0 CACHE STRING "" FORCE )

ChangeLog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
June 1, 2025: version 1.2.0
1+
July 25, 2025: version 1.2.0
22

33
* v2.1 C API: using the new GrB_get/set methods in the C API;
44
LAGraph can now use a "vanilla" GraphBLAS that supports the v2.1

experimental/algorithm/LAGr_MaxFlow.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
1+
//------------------------------------------------------------------------------
2+
// LAGr_MaxFlow: max flow
3+
//------------------------------------------------------------------------------
4+
5+
// LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved.
6+
// SPDX-License-Identifier: BSD-2-Clause
7+
//
8+
// For additional details (including references to third party source code and
9+
// other files) see the LICENSE file or contact [email protected]. See
10+
// Contributors.txt for a full list of contributors. Created, in part, with
11+
// funding and support from the U.S. Government (see Acknowledgments.txt file).
12+
// DM22-0790
13+
14+
// Contributed by Darin Peries and Tim Davis, Texas A&M University
15+
16+
//------------------------------------------------------------------------------
117

218
#include <LAGraphX.h>
319
#include "LG_internal.h"
420
#include <LAGraph.h>
521

22+
#if LG_SUITESPARSE_GRAPHBLAS_V10
23+
624
//------------------------------------------------------------------------------
725
// LG_augment_maxflow
826
//------------------------------------------------------------------------------
927

1028
// LG_augment_maxflow is a function used to sum the current excess flow of the
1129
// sink into the output variable f for each iteration.
1230

13-
1431
#undef LG_FREE_ALL
1532
#define LG_FREE_ALL ;
1633

@@ -450,13 +467,16 @@ JIT_STR(void MF_getResidual(double * res, const MF_flowEdge * flow_edge){
450467
JIT_STR(void MF_extractMatrixFlow(double* flow, const MF_flowEdge* edge){*flow = edge->flow;}, GRB_EMFLOW_STR)
451468

452469

470+
#endif
453471

454472
//------------------------------------------------------------------------------
455473
// LAGraph_MaxFlow
456474
//------------------------------------------------------------------------------
457475

458476
int LAGr_MaxFlow(double* f, GrB_Matrix* flow_mtx, LAGraph_Graph G, GrB_Index src, GrB_Index sink, char *msg){
459477

478+
#if LG_SUITESPARSE_GRAPHBLAS_V10
479+
460480
//types
461481
GrB_Type GrB_FlowEdge = NULL ;
462482
GrB_Type GrB_ResultTuple = NULL ;
@@ -930,4 +950,7 @@ int LAGr_MaxFlow(double* f, GrB_Matrix* flow_mtx, LAGraph_Graph G, GrB_Index src
930950

931951
LG_FREE_ALL;
932952
return GrB_SUCCESS;
953+
#else
954+
return GrB_NOT_IMPLEMENTED ;
955+
#endif
933956
}

experimental/algorithm/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* LAGraph_msf: Minimum spanning forest
2323
* LAGraph_scc: Strongly connected components
2424

25+
* LAGraph_MaxFlow: maximum flow
26+
2527
* LAGraph_AllKCore: all K-cores of a graph
2628
* LAGraph_KCore: a single K-core of a graph
2729
* LAGraph_KCoreDecompose:

experimental/test/test_MaxFlow.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
//------------------------------------------------------------------------------
2+
// experimental/test/test_MaxFlow: tests for LAGr_MaxFlow
3+
//------------------------------------------------------------------------------
4+
5+
// LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved.
6+
// SPDX-License-Identifier: BSD-2-Clause
7+
//
8+
// For additional details (including references to third party source code and
9+
// other files) see the LICENSE file or contact [email protected]. See
10+
// Contributors.txt for a full list of contributors. Created, in part, with
11+
// funding and support from the U.S. Government (see Acknowledgments.txt file).
12+
// DM22-0790
13+
14+
// Contributed by Darin Peries and Tim Davis, Texas A&M University
15+
16+
//------------------------------------------------------------------------------
117

218
#include <acutest.h>
319
#include <LAGraphX.h>
@@ -34,6 +50,7 @@ test_info tests[] = {
3450
//399 11098623877 alt sink and src for test 6
3551

3652
void test_MaxFlow(void) {
53+
#if LG_SUITESPARSE_GRAPHBLAS_V10
3754
LAGraph_Init(msg);
3855
//OK(LG_SET_BURBLE(1));
3956
OK(LG_SET_BURBLE(0));
@@ -61,10 +78,12 @@ void test_MaxFlow(void) {
6178
OK(LAGraph_Delete(&G, msg));
6279
}
6380
LAGraph_Finalize(msg);
81+
#endif
6482
}
6583

6684
void test_MaxFlowMtx(void) {
6785
LAGraph_Init(msg);
86+
#if LG_SUITESPARSE_GRAPHBLAS_V10
6887
//OK(LG_SET_BURBLE(1));
6988
OK(LG_SET_BURBLE(0));
7089
OK(GxB_Global_Option_set(GxB_JIT_C_CONTROL, 4));
@@ -100,6 +119,7 @@ void test_MaxFlowMtx(void) {
100119
GrB_free(&flow_mtx);
101120
OK(LAGraph_Delete(&G, msg));
102121
}
122+
#endif
103123
LAGraph_Finalize(msg);
104124
}
105125

include/LAGraph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// See also the LAGraph_Version utility method, which returns these values.
3838
// These definitions are derived from LAGraph/CMakeLists.txt.
3939

40-
#define LAGRAPH_DATE "June 1, 2025"
40+
#define LAGRAPH_DATE "July 25, 2025"
4141
#define LAGRAPH_VERSION_MAJOR 1
4242
#define LAGRAPH_VERSION_MINOR 2
4343
#define LAGRAPH_VERSION_UPDATE 0

0 commit comments

Comments
 (0)