class_docstr: Class for complement graphs.
  
  The main goal is to be able to work with big and dense graphs with
  a low memory footprint.
  
  In this class you add the edges that *do not exist* in the dense graph,
  the report methods of the class return the neighbors, the edges and
  the degree as if it was the dense graph. Thus it's possible to use
  an instance of this class with some of NetworkX functions. In this
  case we only use k-core, connected_components, and biconnected_components.
class_docstr_tok: ["Class","for","complement","graphs",".","The","main","goal","is","to","be","able","to","work","with","big","and","dense","graphs","with","a","low","memory","footprint",".","In","this","class","you","add","the","edges","that","*","do","not","exist","*","in","the","dense","graph",",","the","report","methods","of","the","class","return","the","neighbors",",","the","edges","and","the","degree","as","if","it","was","the","dense","graph",".","Thus","it","'s","possible","to","use","an","instance","of","this","class","with","some","of","NetworkX","functions",".","In","this","case","we","only","use","k-core",",","connected_components",",","and","biconnected_components","."]
docstr: This subgraph method returns a full AntiGraph. Not a View
docstr_tok: ["This","subgraph","method","returns","a","full","AntiGraph",".","Not","a","View"]
code: def subgraph(self, nodes):
      """This subgraph method returns a full AntiGraph. Not a View"""
      nodes = set(nodes)
      G = _AntiGraph()
      G.add_nodes_from(nodes)
      for n in G:
          Gnbrs = G.adjlist_inner_dict_factory()
          G._adj[n] = Gnbrs
          for nbr, d in self._adj[n].items():
              if nbr in G._adj:
                  Gnbrs[nbr] = d
                  G._adj[nbr][n] = d
      G.graph = self.graph
      return G
  
file_path: networkx/networkx/algorithms/approximation/kcomponents.py
imports: import itertools
  from collections import defaultdict
  from collections.abc import Mapping
  from functools import cached_property
  import networkx
  from networkx.algorithms.approximation import local_node_connectivity
  from networkx.exception import NetworkXError
  from networkx.utils import not_implemented_for
label_desc: Use image node_id 5 for calling the _AntiGraph obj's underlying member method code with example usage: obj.subgraph(nodes) and returns: G