code: def apply_parents(self, g):
      for node in nx.topological_sort(g):
          if not g.nodes()[node].get("parent_names"):
              g.nodes()[node]["parent_names"] = [
                  parent for parent, _ in g.in_edges(node)
              ]
      return g
  
file_path: dowhy/dowhy/do_samplers/mcmc_sampler.py
imports: from typing import List
  import networkx
  import numpy
  import pymc3
  from dowhy import EstimandType
  from dowhy.do_sampler import DoSampler
label_desc: Use image node_id 3 for calling the McmcSampler obj's underlying member method code with example usage: obj.apply_parents(g) and returns: g