def __eq__(self, edge):
if not isinstance(edge, Edge):<EOL><INDENT>raise Error("<STR_LIT>")<EOL><DEDENT>if self.get_parent_graph().get_top_graph_type() == '<STR_LIT>':<EOL><INDENT>if ( ( self.get_source() == edge.get_source() and self.get_destination() == edge.get_destination() ) or<EOL>( edge.get_source() == self.get_destination() and edge.get_destination() == self.get_source() ) ):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if self.get_source()==edge.get_source() and self.get_destination()==edge.get_destination() :<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>
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