def METHOD_NAME(self, dag):
    """Run the DenseLayout pass on `dag`.
    Pick a convenient layout depending on the best matching
    qubit connectivity, and set the property `layout`.
    Args:
        dag (DAGCircuit): DAG to find layout for.
    Raises:
        TranspilerError: if dag wider than self.coupling_map
    """
    if self.coupling_map is None:
        raise TranspilerError(
            "A coupling_map or target with constrained qargs is necessary to run the pass."
        )
    layout_components = disjoint_utils.run_pass_over_connected_components(
        dag,
        self.coupling_map if self.target is None else self.target,
        self._inner_run,
    )
    layout_mapping = {}
    for component in layout_components:
        layout_mapping.update(component)
    layout = Layout(layout_mapping)
    for qreg in dag.qregs.values():
        layout.add_register(qreg)
    self.property_set["layout"] = layout