# This code is part of Qiskit.## (C) Copyright IBM 2017, 2020## This code is licensed under the Apache License, Version 2.0. You may# obtain a copy of this license in the LICENSE.txt file in the root directory# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.## Any modifications or derivative works of this code must retain this# copyright notice, and modified files need to carry a notice indicating# that they have been altered from the originals."""Edge Module"""fromtypingimportList,Optionalfromqiskit_qec.geometry.model.shape_objectimportShapeObjectfromqiskit_qec.geometry.model.verteximportVertex# pylint: disable=invalid-name
[docs]classEdge(ShapeObject):"""Edge"""def__init__(self,vertices:List[Vertex],next_edge:Optional["Edge"]=None,previous_edge:Optional["Edge"]=None,)->None:"""Inits Edge Args: vertices (Tuple[Vertex, Vertex]): Endpoints of the edge. next_edge: Next edge previous_edge: Previous edge """super().__init__()self.vertices=verticesself.coincident_edges=[]self.next=next_edgeself.previous=previous_edgeforiteminself.vertices:item.add_parent(self)def__repr__(self)->str:string="Edge"+self.__str__()returnstringdef__str__(self):string="["forvertexinself.vertices[:-1]:string+=vertex.__str__()string+=","string+=self.vertices[-1].__str__()string+="]"returnstring