LCOV - code coverage report
Current view: top level - src/algorithm - LAGraph_TriangleCount.c (source / functions) Hit Total Coverage
Test: LAGraph code coverage report. Commit id: 3b461aa. Current time (UTC): 2024-01-25T16:04:32Z Lines: 5 5 100.0 %
Date: 2024-01-25 16:05:28 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //------------------------------------------------------------------------------
       2             : // LAGraph_TriangleCount:  triangle counting dispatch, basic API
       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 Scott McMillan, SEI Carnegie Mellon University
      15             : 
      16             : //------------------------------------------------------------------------------
      17             : 
      18             : // This is a Basic algorithm (G->nself_edges, G->out_degree,
      19             : // G->is_symmetric_structure are computed, if not present).
      20             : 
      21             : #define LG_FREE_ALL ;
      22             : 
      23             : #include <LAGraph.h>
      24             : #include "LG_internal.h"
      25             : #include "LG_alg_internal.h"
      26             : 
      27             : // Pick the default method with auto presort.  Compute G->nself_edges, and
      28             : // G->out_degree if needed.  Determine if G->A is symmetric, if not known.
      29             : 
      30         404 : int LAGraph_TriangleCount
      31             : (
      32             :     // output:
      33             :     uint64_t *ntriangles,   // number of triangles in G.
      34             :     // input/output:
      35             :     LAGraph_Graph G,        // graph to examine; cached properties computed.
      36             :     char *msg
      37             : )
      38             : {
      39             :     // find out if graph is symmetric, compute G->out_degree, and G->nself_edges
      40         404 :     LG_TRY (LAGraph_Cached_IsSymmetricStructure (G, msg)) ;
      41         404 :     LG_TRY (LAGraph_Cached_OutDegree (G, msg)) ;
      42         344 :     LG_TRY (LAGraph_Cached_NSelfEdges (G, msg)) ;
      43             : 
      44             :     // auto method and auto sort
      45         344 :     return (LAGr_TriangleCount (ntriangles, G, NULL, NULL, msg)) ;
      46             : }

Generated by: LCOV version 1.14