def __eq__(self, other):
def attrs_eq(list1, list2):<EOL><INDENT>for each in list1:<EOL><INDENT>if (each not in list2): return False<EOL><DEDENT>for each in list2:<EOL><INDENT>if (each not in list1): return False<EOL><DEDENT>return True<EOL><DEDENT>def edges_eq():<EOL><INDENT>for edge in self.edges():<EOL><INDENT>if (self.edge_weight(edge) != other.edge_weight(edge)): return False<EOL>if (self.edge_label(edge) != other.edge_label(edge)): return False<EOL>if (not attrs_eq(self.edge_attributes(edge), other.edge_attributes(edge))): return False <EOL><DEDENT>return True<EOL><DEDENT>def nodes_eq():<EOL><INDENT>for node in self:<EOL><INDENT>if (not attrs_eq(self.node_attributes(node), other.node_attributes(node))): return False <EOL><DEDENT>return True<EOL><DEDENT>return nodes_eq() and edges_eq()<EOL>
Return whether this graph is equal to another one.

@type other: graph, digraph
@param other: Other graph or digraph

@rtype: boolean
@return: Whether this graph and the other are equal.