Line data Source code
1 : //------------------------------------------------------------------------------ 2 : // LAGr_ConnectedComponents: connected components of an undirected graph 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 permission@sei.cmu.edu. 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 Timothy A. Davis, Texas A&M University 15 : 16 : //------------------------------------------------------------------------------ 17 : 18 : // This is an Advanced algorithm (G->is_symmetric_structure must be known). 19 : 20 : // Connected Components via LG_CC_FastSV6 if using SuiteSparse:GraphBLAS and 21 : // its GxB extensions, or LG_CC_Boruvka otherwise. The former is much faster. 22 : 23 : #include "LG_alg_internal.h" 24 : 25 62 : int LAGr_ConnectedComponents 26 : ( 27 : // output: 28 : GrB_Vector *component, // component(i)=s if node i is in the component 29 : // whose representative node is s 30 : // input: 31 : const LAGraph_Graph G, // input graph 32 : char *msg 33 : ) 34 : { 35 : 36 : #if LAGRAPH_SUITESPARSE 37 62 : return (LG_CC_FastSV6 (component, G, msg)) ; 38 : #else 39 : return (LG_CC_Boruvka (component, G, msg)) ; 40 : #endif 41 : }