code: def k_truss(
      G: Union[Graph, "networkx.Graph"], k: int
  ) -> Union[Graph, "networkx.Graph"]:
      """
      Returns the K-Truss subgraph of a graph for a specific k.
  
      NOTE: this function is currently not available on CUDA 11.4 systems.
  
      The k-truss of a graph is a subgraph where each edge is part of at least
      (k−2) triangles. K-trusses are used for finding tighlty knit groups of
      vertices in a graph. A k-truss is a relaxation of a k-clique in the graph
      and was define in [1]. Finding cliques is computationally demanding and
      finding the maximal k-clique is known to be NP-Hard.
  
      Parameters
      ----------
      G : cuGraph.Graph or networkx.Graph
          cuGraph graph descriptor with connectivity information. k-Trusses are
          defined for only undirected graphs as they are defined for
          undirected triangle in a graph.
  
      k : int
          The desired k to be used for extracting the k-truss subgraph.
  
      Returns
      -------
      G_truss : cuGraph.Graph or networkx.Graph
          A cugraph graph descriptor with the k-truss subgraph for the given k.
          The networkx graph will NOT have all attributes copied over
  
      Examples
      --------
      >>> from cugraph.datasets import karate
      >>> G = karate.get_graph(download=True)
      >>> k_subgraph = cugraph.k_truss(G, 3)
  
      """
  
      _ensure_compatible_cuda_version()
  
      G, isNx = ensure_cugraph_obj_for_nx(G)
  
      if isNx is True:
          k_sub = ktruss_subgraph(G, k)
          S = cugraph_to_nx(k_sub)
          return S
      else:
          return ktruss_subgraph(G, k)
  
file_path: cugraph/python/cugraph/cugraph/community/ktruss_subgraph.py
imports: from cugraph.structure.graph_classes import Graph
  from typing import Union
  from cugraph.utilities import ensure_cugraph_obj_for_nx, cugraph_to_nx
  from pylibcugraph import k_truss_subgraph
  from pylibcugraph import ResourceHandle
  import warnings
  from numba import cuda
  import cudf
  from cugraph.utilities.utils import import_optional
label_desc: Use image node_id 2 for calling a global function with example usage: k_truss(G, k) and returns: S, ktruss_subgraph