code: def is_threshold_graph(G):
      """
      Returns `True` if `G` is a threshold graph.
  
      Parameters
      ----------
      G : NetworkX graph instance
          An instance of `Graph`, `DiGraph`, `MultiGraph` or `MultiDiGraph`
  
      Returns
      -------
      bool
          `True` if `G` is a threshold graph, `False` otherwise.
  
      Examples
      --------
      >>> from networkx.algorithms.threshold import is_threshold_graph
      >>> G = nx.path_graph(3)
      >>> is_threshold_graph(G)
      True
      >>> G = nx.barbell_graph(3, 3)
      >>> is_threshold_graph(G)
      False
  
      References
      ----------
      .. [1] Threshold graphs: https://en.wikipedia.org/wiki/Threshold_graph
      """
      return is_threshold_sequence([d for n, d in G.degree()])
  
imports: from math import sqrt
  import networkx
  from networkx.utils import py_random_state
label_desc: Use image node_id 1 for calling a global function with example usage: is_threshold_graph(G) and returns: is_threshold_sequence