Line data Source code
1 : //------------------------------------------------------------------------------ 2 : // LG_KindName: return the name of a kind 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 334 : int LG_KindName 21 : ( 22 : char *name, // name of the kind (user provided array of size at least 23 : // LAGRAPH_MAX_NAME_LEN) 24 : LAGraph_Kind kind, // graph kind 25 : char *msg 26 : ) 27 : { 28 : 29 : //-------------------------------------------------------------------------- 30 : // check inputs 31 : //-------------------------------------------------------------------------- 32 : 33 334 : LG_CLEAR_MSG ; 34 334 : LG_ASSERT (name != NULL, GrB_NULL_POINTER) ; 35 : 36 : //-------------------------------------------------------------------------- 37 : // determine the name of the kind 38 : //-------------------------------------------------------------------------- 39 : 40 334 : switch (kind) 41 : { 42 91 : case LAGraph_ADJACENCY_UNDIRECTED : strcpy (name, "undirected"); break ; 43 241 : case LAGraph_ADJACENCY_DIRECTED : strcpy (name, "directed") ; break ; 44 1 : case LAGraph_KIND_UNKNOWN : strcpy (name, "unknown") ; break ; 45 1 : default : LG_ASSERT_MSG (false, GrB_INVALID_VALUE, "invalid kind") ; 46 : } 47 : 48 333 : return (GrB_SUCCESS) ; 49 : }