code: def _get_node_groups(self):
          node_dict = {node['data']['id']: {'sources': [], 'targets': []}
                       for node in self._nodes}
          for edge in self._edges:
              edge_data = (edge['data']['i'], edge['data']['polarity'],
                           edge['data']['source'])
              node_dict[edge['data']['target']]['sources'].append(edge_data)
              edge_data = (edge['data']['i'], edge['data']['polarity'],
                           edge['data']['target'])
              node_dict[edge['data']['source']]['targets'].append(edge_data)
          node_key_dict = collections.defaultdict(lambda: [])
          for node_id, node_d in node_dict.items():
              key = self._get_node_key(node_d)
              node_key_dict[key].append(node_id)
          node_groups = [g for g in node_key_dict.values() if (len(g) > 1)]
          return node_groups