class_docstr: Class for creating and modifying the causal graph.
  
  Accepts a networkx DiGraph, a :py:class:`ProbabilisticCausalModel <dowhy.gcm.ProbabilisticCausalModel`, a graph string (or a text file) in gml format (preferred) or dot format. Graphviz-like attributes can be set for edges and nodes. E.g. style="dashed" as an edge attribute ensures that the edge is drawn with a dashed line.
  
   If a graph string is not given, names of treatment, outcome, and confounders, instruments and effect modifiers (if any) can be provided to create the graph.
class_docstr_tok: ["Class","for","creating","and","modifying","the","causal","graph",".","Accepts","a","networkx","DiGraph",",","a",":","py",":","class",":","`","ProbabilisticCausalModel","<","dowhy.gcm.ProbabilisticCausalModel","`",",","a","graph","string","(","or","a","text","file",")","in","gml","format","(","preferred",")","or","dot","format",".","Graphviz-like","attributes","can","be","set","for","edges","and","nodes",".","E.g",".","style=","''","dashed","''","as","an","edge","attribute","ensures","that","the","edge","is","drawn","with","a","dashed","line",".","If","a","graph","string","is","not","given",",","names","of","treatment",",","outcome",",","and","confounders",",","instruments","and","effect","modifiers","(","if","any",")","can","be","provided","to","create","the","graph","."]
code: def get_effect_modifiers(self, nodes1, nodes2):
      # Return effect modifiers according to the graph
      modifiers = set()
      for node in nodes2:
          modifiers = modifiers.union(self.get_ancestors(node))
      modifiers = modifiers.difference(nodes1)
      for node in nodes1:
          modifiers = modifiers.difference(self.get_ancestors(node))
      # removing all mediators
      for node1 in nodes1:
          for node2 in nodes2:
              all_directed_paths = nx.all_simple_paths(
                  self._graph, node1, node2
              )
              for path in all_directed_paths:
                  modifiers = modifiers.difference(path)
      # Also add any effect modifiers that could not be auto-detected (e.g., they are also common causes)
      marked_modifiers = [
          n
          for n, ndata in self._graph.nodes(data=True)
          if "effectmodifier" in ndata
      ]
      modifiers = modifiers.union(marked_modifiers)
      return list(modifiers)
  
imports: import itertools
  import logging
  import re
  import networkx
  from dowhy.gcm.causal_models import ProbabilisticCausalModel
  from dowhy.utils.api import parse_state
  from dowhy.utils.graph_operations import daggity_to_dot
  from dowhy.utils.plotting import plot
label_desc: Use image node_id 15 for calling the CausalGraph obj's underlying member method code with example usage: obj.get_effect_modifiers(nodes1, nodes2) and returns: list