code: def all_triplets(G):
      """Returns a generator of all possible sets of 3 nodes in a DiGraph.
  
      .. deprecated:: 3.3
  
         all_triplets is deprecated and will be removed in NetworkX version 3.5.
         Use `itertools.combinations` instead::
  
            all_triplets = itertools.combinations(G, 3)
  
      Parameters
      ----------
      G : digraph
         A NetworkX DiGraph
  
      Returns
      -------
      triplets : generator of 3-tuples
         Generator of tuples of 3 nodes
  
      Examples
      --------
      >>> G = nx.DiGraph([(1, 2), (2, 3), (3, 4)])
      >>> list(nx.all_triplets(G))
      [(1, 2, 3), (1, 2, 4), (1, 3, 4), (2, 3, 4)]
  
      """
      import warnings
  
      warnings.warn(
          (
              "\n\nall_triplets is deprecated and will be rmoved in v3.5.\n"
              "Use `itertools.combinations(G, 3)` instead."
          ),
          category=DeprecationWarning,
          stacklevel=4,
      )
      triplets = combinations(G.nodes(), 3)
      return triplets
  
file_path: networkx/networkx/algorithms/triads.py
imports: from collections import defaultdict
  from itertools import combinations, permutations
  import networkx
  from networkx.utils import not_implemented_for, py_random_state
label_desc: Use image node_id 4 for calling a global function with example usage: all_triplets(G) and returns: triplets