def __copy__(self):
        """Creates a new UndirectedHypergraph object with the same node and
        hyperedge structure.
        Copies of the nodes' and hyperedges' attributes are stored
        and used in the new hypergraph.

        :returns: UndirectedHypergraph -- a new hypergraph that is a copy of
                the current hypergraph

        """
        new_H = UndirectedHypergraph()

        # Loop over every node and its corresponding attribute dict
        # in the original hypergraph's _node_attributes dict
        for node, attr_dict in self._node_attributes.items():
            # Create a new dict for that node to store that node's attributes
            new_H._node_attributes[node] = {}
            # Loop over each attribute of that node in the original hypergraph
            # and, for each key, copy the corresponding value into the new
            # hypergraph's dictionary using the same key
            for attr_name, attr_value in attr_dict.items():
                new_H._node_attributes[node][attr_name] = \
                    copy.copy(attr_value)

        # Loop over every hyperedge_id and its corresponding attribute dict
        # in the original hypergraph's _hyperedge_attributes dict
        for hyperedge_id, attr_dict in self._hyperedge_attributes.items():
            # Create a new dict for that node to store that node's attributes
            new_H._hyperedge_attributes[hyperedge_id] = {}
            # Loop over each attribute of that hyperedge in the original
            # hypergraph and, for each key, copy the corresponding value
            # the new hypergraph's dictionary
            for attr_name, attr_value in attr_dict.items():
                new_H.\
                    _hyperedge_attributes[hyperedge_id][attr_name] = \
                    copy.copy(attr_value)

        # Copy the original hypergraph's nodes' stars
        new_H._star = self._star.copy()
        for node in self._node_attributes.keys():
            new_H._star[node] = self._star[node].copy()

        # Copy the original hypergraph's composed hyperedges
        for frozen_nodes, hyperedge_id in self._node_set_to_hyperedge.items():
            new_H._node_set_to_hyperedge[frozen_nodes] = \
                copy.copy(hyperedge_id)

        # Start assigning edge labels at the same
        new_H._current_hyperedge_id = self._current_hyperedge_id

        return new_H
def __copy__ ( self ) : new_H = UndirectedHypergraph ( ) for node , attr_dict in self . _node_attributes . items ( ) : new_H . _node_attributes [ node ] = { } for attr_name , attr_value in attr_dict . items ( ) : new_H . _node_attributes [ node ] [ attr_name ] = copy . copy ( attr_value ) for hyperedge_id , attr_dict in self . _hyperedge_attributes . items ( ) : new_H . _hyperedge_attributes [ hyperedge_id ] = { } for attr_name , attr_value in attr_dict . items ( ) : new_H . _hyperedge_attributes [ hyperedge_id ] [ attr_name ] = copy . copy ( attr_value ) new_H . _star = self . _star . copy ( ) for node in self . _node_attributes . keys ( ) : new_H . _star [ node ] = self . _star [ node ] . copy ( ) for frozen_nodes , hyperedge_id in self . _node_set_to_hyperedge . items ( ) : new_H . _node_set_to_hyperedge [ frozen_nodes ] = copy . copy ( hyperedge_id ) new_H . _current_hyperedge_id = self . _current_hyperedge_id return new_H
Creates a new UndirectedHypergraph object with the same node and
        hyperedge structure.
        Copies of the nodes' and hyperedges' attributes are stored
        and used in the new hypergraph.

        :returns: UndirectedHypergraph -- a new hypergraph that is a copy of
                the current hypergraph