def _check_hyperedge_attributes_consistency(self):
        """Consistency Check 1: consider all hyperedge IDs listed in
        _hyperedge_attributes

        :raises: ValueError -- detected inconsistency among dictionaries

        """
        # required_attrs are attributes that every hyperedge must have.
        required_attrs = ['weight', 'tail', 'head',
                          '__frozen_tail', '__frozen_head']

        # Get list of hyperedge_ids from the hyperedge attributes dict
        hyperedge_ids_from_attributes = set(self._hyperedge_attributes.keys())

        # Perform consistency checks on each hyperedge id.
        for hyperedge_id in hyperedge_ids_from_attributes:

            # Check 1.1: make sure every hyperedge id has a weight,
            # tail, head, frozen tail, and frozen head
            hyperedge_attr_dict = self._hyperedge_attributes[hyperedge_id]
            for required_attr in required_attrs:
                if required_attr not in hyperedge_attr_dict:
                    raise ValueError(
                        'Consistency Check 1.1 Failed: hyperedge ' +
                        'attribute dictionary for hyperedge_id ' +
                        '%s is missing required attribute %s' %
                        (hyperedge_id, required_attr))

            # Check 1.2: make sure frozenset(tail) == __frozen_tail
            if frozenset(hyperedge_attr_dict['tail']) != \
               hyperedge_attr_dict['__frozen_tail']:
                raise ValueError(
                    'Consistency Check 1.2 Failed: frozenset ' +
                    'tail is different from __frozen_tail ' +
                    'attribute for hyperedge id %s' % (hyperedge_id))

            # Check 1.3: make sure frozenset(head) == __frozen_head
            if frozenset(hyperedge_attr_dict['head']) != \
               hyperedge_attr_dict['__frozen_head']:
                raise ValueError(
                    'Consistency Check 1.3 Failed: frozenset ' +
                    'head is different from __frozen_head ' +
                    'attribute for hyperedge id %s' % (hyperedge_id))

            # get tail and head frozenset
            tailset = hyperedge_attr_dict['__frozen_tail']
            headset = hyperedge_attr_dict['__frozen_head']

            # Check 1.4: make sure successors dictionary contains the
            # hyperedge id. Need to also check that tailset and
            # headset are entries into the dict.
            if tailset not in self._successors or \
               headset not in self._successors[tailset] or \
               self._successors[tailset][headset] != hyperedge_id:
                raise ValueError(
                    'Consistency Check 1.4 Failed: hyperedge ' +
                    'id %s not in self._successors.' % (hyperedge_id))

            # Check 1.5: make sure predecessors dictionary contains
            # the hyperedge id. Need to also check that headset and
            # tailset are entries into the dict.
            if headset not in self._predecessors or \
               tailset not in self._predecessors[headset] or \
               self._predecessors[headset][tailset] != hyperedge_id:
                raise ValueError(
                    'Consistency Check 1.5 Failed: hyperedge ' +
                    'id %s not in self._predecessors.' % (hyperedge_id))

            # Check 1.6: make sure every tail node in tailset
            # contains the hyperedge_id in the forward star.
            for tail_node in tailset:
                if hyperedge_id not in self._forward_star[tail_node]:
                    raise ValueError(
                        'Consistency Check 1.6 Failed: hyperedge ' +
                        'id ' + hyperedge_id + ' is not in the ' +
                        'forward star of tail node ' + tail_node)

            # Check 1.7: make sure every head node in headset
            # contains the hyperedge_id in the backward star.
            for head_node in headset:
                if hyperedge_id not in self._backward_star[head_node]:
                    raise ValueError(
                        'Consistency Check 1.7 Failed: hyperedge ' +
                        'id ' + hyperedge_id + ' is not in the ' +
                        'backward star of head node ' + tail_node)
Consistency Check 1: consider all hyperedge IDs listed in
        _hyperedge_attributes

        :raises: ValueError -- detected inconsistency among dictionaries