docs: def _check_node_consistency(self):
          """Consistency Check 5: check for misplaced nodes
  
          :raises: ValueError -- detected inconsistency among dictionaries
  
          """
          # Get list of nodes from the node attributes dict
          nodes_from_attributes = set(self._node_attributes.keys())
  
          # Get list of hyperedge_ids from the hyperedge attributes dict
          hyperedge_ids_from_attributes = set(self._hyperedge_attributes.keys())
  
          # Check 5.1: all nodes in the forward star must be in the
          # nodes from attributes
          forward_diff = set(self._forward_star.keys()) - nodes_from_attributes
          if forward_diff != set():
              raise ValueError(
                  'Consistency Check 5.1 Failed: nodes %s ' % forward_diff +
                  '(from forward star keys) is not in the node ' +
                  'attribute dict.')
  
          # Check 5.2: all nodes in the backward star must be in the
          # nodes from attributes
          backward_diff = set(self._backward_star.keys()) - nodes_from_attributes
          if backward_diff != set():
              raise ValueError(
                  'Consistency Check 5.2 Failed: node %s ' % backward_diff +
                  '(from backward star keys) is not in the node ' +
                  'attribute dict.')
  
          # Note that, by Check 5.1 and 5.2, self._forward_star.keys() =
          # self._backward_star.keys().
  
          # Check 5.3: all nodes in hyperedge_attributes dictionary must
          # be in the nodes from attributes.
          for hyperedge_id in hyperedge_ids_from_attributes:
              for tailnode in \
                      self._hyperedge_attributes[hyperedge_id]['tail']:
                  if tailnode not in nodes_from_attributes:
                      raise ValueError(
                          'Consistency Check 5.3.1 Failed: tail ' +
                          'node %s of ' % tailnode +
                          'of hyperedge id %s ' % hyperedge_id +
                          'is not in node attribute dict')
  
              for headnode in self._hyperedge_attributes[hyperedge_id]['head']:
                  if headnode not in nodes_from_attributes:
                      raise ValueError(
                          'Consistency Check 5.3.2 Failed: head ' +
                          'node %s of ' % headnode +
                          'of hyperedge id %s ' % hyperedge_id +
                          'is not in node attribute dict')
  
          # get set of nodes in predecessor dictionary.
          # adds both nodes in headset and nodes in tailset.
          nodes_in_predecessor_dict = set()
          for headset in self._predecessors.keys():
              nodes_in_predecessor_dict.update(headset)
              for tailset in self._predecessors[headset].keys():
                  nodes_in_predecessor_dict.update(tailset)
  
          # get set of nodes in successor dictionary.
          # adds both nodes in headset and nodes in tailset.
          nodes_in_successor_dict = set()
          for headset in self._successors.keys():
              nodes_in_successor_dict.update(headset)
              for tailset in self._successors[headset].keys():
                  nodes_in_successor_dict.update(tailset)
  
          # Check 5.4: the set of nodes in successor dict is the same as
          # the set of nodes in the predecessor dict
          if nodes_in_predecessor_dict != nodes_in_successor_dict:
              raise ValueError(
                  'Consistency Check 5.4 Failed: nodes in ' +
                  'successor dict are different than nodes ' +
                  'in predecessor dict')
  
          # Check 5.5: all nodes in predecessor and successor dict must
          # be in the nodes from attributes (since 5.4 ensures they're the same)
          for node in nodes_in_predecessor_dict:
              if node not in nodes_from_attributes:
                  raise ValueError(
                      'Consistency Check 5.5 Failed: node %s ' % node +
                      'from predecessor or successor dictionary ' +
                      'is not in node attribute dict')