code: def _group_directional(self, clusters, adj_list, counts):
          ''' return groups for directional method'''
  
          observed = set()
          groups = []
          for cluster in clusters:
              if len(cluster) == 1:
                  groups.append(list(cluster))
                  observed.update(cluster)
              else:
                  cluster = sorted(cluster, key=lambda x: counts[x],
                                   reverse=True)
                  # need to remove any node which has already been observed
                  temp_cluster = []
                  for node in cluster:
                      if node not in observed:
                          temp_cluster.append(node)
                          observed.add(node)
                  groups.append(temp_cluster)
  
          return groupf _group_directional(self, clusters, adj_list, counts):
          ''' return groups for directional method'''
  
          observed = set()
          groups = []
          for cluster in clusters:
              if len(cluster) == 1:
                  groups.append(list(cluster))
                  observed.update(cluster)
              else:
                  cluster = sorted(cluster, key=lambda x: counts[x],
                                   reverse=True)
                  # need to remove any node which has already been observed
                  temp_cluster = []
                  for node in cluster:
                      if node not in observed:
                          temp_cluster.append(node)
                          observed.add(node)
                  groups.append(temp_cluster)
  
          return groups
docs: return groups for directional method