LCOV - code coverage report
Current view: top level - src/utility - LAGraph_DeleteCached.c (source / functions) Hit Total Coverage
Test: LAGraph code coverage report. Commit id: cc56ed4. Current time (UTC): 2024-08-30T17:14:30Z Lines: 16 16 100.0 %
Date: 2024-08-30 17:16:41 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //------------------------------------------------------------------------------
       2             : // LAGraph_DeleteCached: deletes the cached properties 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        1527 : int LAGraph_DeleteCached
      21             : (
      22             :     // input/output:
      23             :     LAGraph_Graph G,    // G stays valid, only cached properties are freed
      24             :     char *msg
      25             : )
      26             : {
      27             : 
      28             :     //--------------------------------------------------------------------------
      29             :     // check inputs
      30             :     //--------------------------------------------------------------------------
      31             : 
      32        1527 :     LG_CLEAR_MSG ;
      33        1527 :     if (G == NULL)
      34             :     {
      35             :         // success: nothing to do
      36           6 :         return (GrB_SUCCESS) ;
      37             :     }
      38             : 
      39             :     //--------------------------------------------------------------------------
      40             :     // free all cached properties of the graph
      41             :     //--------------------------------------------------------------------------
      42             : 
      43        1521 :     GRB_TRY (GrB_free (&(G->AT))) ;
      44        1521 :     GRB_TRY (GrB_free (&(G->out_degree))) ;
      45        1521 :     GRB_TRY (GrB_free (&(G->in_degree))) ;
      46        1521 :     GRB_TRY (GrB_free (&(G->emin))) ;
      47        1521 :     GRB_TRY (GrB_free (&(G->emax))) ;
      48             : 
      49             :     //--------------------------------------------------------------------------
      50             :     // clear the cached scalar properties of the graph
      51             :     //--------------------------------------------------------------------------
      52             : 
      53        1521 :     G->is_symmetric_structure =
      54        1521 :         (G->kind == LAGraph_ADJACENCY_UNDIRECTED)
      55             :         ? LAGraph_TRUE
      56        1521 :         : LAGRAPH_UNKNOWN ;
      57        1521 :     G->emin_state = LAGRAPH_UNKNOWN ;
      58        1521 :     G->emax_state = LAGRAPH_UNKNOWN ;
      59        1521 :     G->nself_edges = LAGRAPH_UNKNOWN ;
      60        1521 :     return (GrB_SUCCESS) ;
      61             : }

Generated by: LCOV version 1.14