class_docstr: Implements methods for finding optimal (efficient) backdoor sets.
class_docstr_tok: ["Implements","methods","for","finding","optimal","(","efficient",")","backdoor","sets","."]
docstr: Returns the H1 graph associated with treatment, outcome, conditional
  and observable variables. See Smucler, Sapienza and Rotnitzky (2021),
  Biometrika, for the full definition of this graph.
  
  :returns H1: nx.Graph
      The H1 graph.
docstr_tok: ["Returns","the","H1","graph","associated","with","treatment",",","outcome",",","conditional","and","observable","variables",".","See","Smucler",",","Sapienza","and","Rotnitzky","(","2021",")",",","Biometrika",",","for","the","full","definition","of","this","graph",".",":","returns","H1",":","nx.Graph","The","H1","graph","."]
code: def build_H1(self):
      """Returns the H1 graph associated with treatment, outcome, conditional
      and observable variables. See Smucler, Sapienza and Rotnitzky (2021),
      Biometrika, for the full definition of this graph.
  
      :returns H1: nx.Graph
          The H1 graph.
      """
      H0 = self.build_H0()
  
      ignore_nodes = self.ignore()
  
      H1 = H0.copy().subgraph(H0.nodes() - ignore_nodes)
      H1 = nx.Graph(H1)
      vertices_list = list(H1.nodes())
  
      for i, node1 in enumerate(vertices_list):
          for node2 in vertices_list[(i + 1) :]:
              for path in nx.all_simple_paths(
                  H0, source=node1, target=node2
              ):
                  if set(path).issubset(
                      ignore_nodes.union({node1, node2})
                  ):
                      H1.add_edge(node1, node2)
                      break
  
      for node in self.conditional_node_names:
          H1.add_edge(self.treatment_name, node)
          H1.add_edge(node, self.outcome_name)
  
      return H1
  
file_path: dowhy/dowhy/causal_identifier/efficient_backdoor.py
imports: from typing import List
  import networkx
  import numpy
label_desc: Use image node_id 9 for calling the EfficientBackdoor obj's underlying member method code with example usage: obj.build_H1() and returns: H1