def run(self, dag):
if self.layout is None:<EOL><INDENT>if self.property_set["<STR_LIT>"]:<EOL><INDENT>self.layout = self.property_set["<STR_LIT>"]<EOL><DEDENT>else:<EOL><INDENT>self.layout = Layout.generate_trivial_layout(*dag.qregs.values())<EOL><DEDENT><DEDENT>self.property_set['<STR_LIT>'] = True<EOL>edges = self.coupling_map.get_edges()<EOL>for gate in dag.twoQ_gates():<EOL><INDENT>physical_q0 = self.layout[gate.qargs[<NUM_LIT:0>]]<EOL>physical_q1 = self.layout[gate.qargs[<NUM_LIT:1>]]<EOL>if isinstance(gate.op, (CXBase, CnotGate)) and (<EOL>physical_q0, physical_q1) not in edges:<EOL><INDENT>self.property_set['<STR_LIT>'] = False<EOL>return<EOL><DEDENT><DEDENT>
If `dag` is mapped and the direction is correct the property
`is_direction_mapped` is set to True (or to False otherwise).

Args:
    dag (DAGCircuit): DAG to check.