code: def compute_node_colors(self):
          
          data = [self.graph.node[n][self.node_color] for n in self.nodes]
  
          if self.group_order == "alphabetically":
              data_reduced = sorted(list(set(data)))
          elif self.group_order == "default":
              data_reduced = list(unique_everseen(data))
  
          dtype = infer_data_type(data)
          n_grps = num_discrete_groups(data)
  
          if dtype == "categorical" or dtype == "ordinal":
              if n_grps <= 8:
                  cmap = get_cmap(
                      cmaps["Accent_{0}".format(n_grps)].mpl_colormap
                  )
              else:
                  cmap = n_group_colorpallet(n_grps)
          elif dtype == "continuous" and not is_data_diverging(data):
              cmap = get_cmap(cmaps["continuous"].mpl_colormap)
          elif dtype == "continuous" and is_data_diverging(data):
              cmap = get_cmap(cmaps["diverging"].mpl_colormap)
  
          for d in data:
              idx = data_reduced.index(d) / n_grps
              self.node_colors.append(cmap(idx))
  
          # Add colorbar if required.ListedColormap
          logging.debug("length of data_reduced: {0}".format(len(data_reduced)))
          logging.debug("dtype: {0}".format(dtype))
          if len(data_reduced) > 1 and dtype == "continuous":
              self.sm = plt.cm.ScalarMappable(
                  cmap=cmap,
                  norm=plt.Normalize(
                      vmin=min(data_reduced),
                      vmax=max(data_reduced),  # noqa  # noqa
                  ),
              )
              self.sm._A = []
docs: Compute the node colors. Also computes the colorbar.