def __eq__(self, edge):
        """Compare two edges.

        If the parent graph is directed, arcs linking
        node A to B are considered equal and A->B != B->A

        If the parent graph is undirected, any edge
        connecting two nodes is equal to any other
        edge connecting the same nodes, A->B == B->A
        """

        if not isinstance(edge, Edge):
            raise pydot.Error("Can not compare an edge to a non-edge object.")

        if self.get_parent_graph().get_top_graph_type() == "graph":
            # If the graph is undirected, the edge has neither
            # source nor destination.
            #
            if (
                self.get_source() == edge.get_source()
                and self.get_destination() == edge.get_destination()
            ) or (
                edge.get_source() == self.get_destination()
                and edge.get_destination() == self.get_source()
            ):
                return True

        else:
            if (
                self.get_source() == edge.get_source()
                and self.get_destination() == edge.get_destination()
            ):
                return True

        return False
Compare two edges.

        If the parent graph is directed, arcs linking
        node A to B are considered equal and A->B != B->A

        If the parent graph is undirected, any edge
        connecting two nodes is equal to any other
        edge connecting the same nodes, A->B == B->A
        
python/aitemplate/utils/visualization/pydot.py