code: def rooted_product(G, H, root):
      """Return the rooted product of graphs G and H rooted at root in H.
  
      A new graph is constructed representing the rooted product of
      the inputted graphs, G and H, with a root in H.
      A rooted product duplicates H for each nodes in G with the root
      of H corresponding to the node in G. Nodes are renamed as the direct
      product of G and H. The result is a subgraph of the cartesian product.
  
      Parameters
      ----------
      G,H : graph
         A NetworkX graph
      root : node
         A node in H
  
      Returns
      -------
      R : The rooted product of G and H with a specified root in H
  
      Notes
      -----
      The nodes of R are the Cartesian Product of the nodes of G and H.
      The nodes of G and H are not relabeled.
      """
      if root not in H:
          raise nx.NetworkXError("root must be a vertex in H")
  
      R = nx.Graph()
      R.add_nodes_from(product(G, H))
  
      R.add_edges_from(((e[0], root), (e[1], root)) for e in G.edges())
      R.add_edges_from(
          ((g, e[0]), (g, e[1])) for g in G for e in H.edges()
      )
  
      return R
  
file_path: networkx/networkx/algorithms/operators/product.py
imports: from itertools import product
  import networkx
  from networkx.utils import not_implemented_for
label_desc: Use image node_id 14 for calling a global function with example usage: rooted_product(G, H, root) and returns: R