def __init__(
        self,
        device_graph: UndirectedHypergraph | None = None,
        crosstalk_graph: UndirectedHypergraph | None = None,
    ) -> None:
        """Inits UndirectedGraphDevice.

        Args:
            device_graph: An undirected hypergraph whose vertices correspond to
                qubits and whose edges determine allowable operations and their
                durations.
            crosstalk_graph: An undirected hypergraph whose vertices are edges
                of device_graph and whose edges give simultaneity constraints
                thereon.

        Raises:
            TypeError: If the crosstalk graph is not a valid crosstalk graph.
        """

        if device_graph is None:
            device_graph = UndirectedHypergraph()
        if not is_undirected_device_graph(device_graph):
            raise TypeError(f'not is_undirected_device_graph({device_graph})')
        if crosstalk_graph is None:
            crosstalk_graph = UndirectedHypergraph()
        if not is_crosstalk_graph(crosstalk_graph):
            raise TypeError(f'not is_crosstalk_graph({crosstalk_graph})')

        self.device_graph = device_graph
        self.crosstalk_graph = crosstalk_graph
Inits UndirectedGraphDevice.

        Args:
            device_graph: An undirected hypergraph whose vertices correspond to
                qubits and whose edges determine allowable operations and their
                durations.
            crosstalk_graph: An undirected hypergraph whose vertices are edges
                of device_graph and whose edges give simultaneity constraints
                thereon.

        Raises:
            TypeError: If the crosstalk graph is not a valid crosstalk graph.
        
cirq-core/cirq/contrib/graph_device/graph_device.py