Line data Source code
1 : //------------------------------------------------------------------------------ 2 : // LAGraph_Cached_NSelfEdges: count the # of diagonal entries of a 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 : #include "LG_internal.h" 19 : 20 985 : int LAGraph_Cached_NSelfEdges 21 : ( 22 : // input/output: 23 : LAGraph_Graph G, // graph to compute G->nself_edges 24 : char *msg 25 : ) 26 : { 27 : 28 : //-------------------------------------------------------------------------- 29 : // clear msg and check G 30 : //-------------------------------------------------------------------------- 31 : 32 985 : LG_CLEAR_MSG_AND_BASIC_ASSERT (G, msg) ; 33 : 34 : // already computed 35 984 : if (G->nself_edges != LAGRAPH_UNKNOWN) 36 : { 37 352 : return (GrB_SUCCESS) ; 38 : } 39 : 40 : //-------------------------------------------------------------------------- 41 : // compute G->nself_edges 42 : //-------------------------------------------------------------------------- 43 : 44 632 : return (LG_nself_edges (&G->nself_edges, G->A, msg)) ; 45 : }