code: def make_temporal_consensus(com_membership):
      r
  
      com_membership = np.array(com_membership)
      # make first indicies be between 0 and 1.
      com_membership[:, 0] = clean_community_indexes(com_membership[:, 0])
      # loop over all timepoints, get jacccard distance in greedy manner for largest community to time period before
      for t in range(1, com_membership.shape[1]):
          ct, counts_t = np.unique(com_membership[:, t], return_counts=True)
          ct = ct[np.argsort(counts_t)[::-1]]
          c1back = np.unique(com_membership[:, t-1])
          new_index = np.zeros(com_membership.shape[0])
          for n in ct:
              if len(c1back) > 0:
                  d = np.ones(int(c1back.max())+1)
                  for m in c1back:
                      v1 = np.zeros(com_membership.shape[0])
                      v2 = np.zeros(com_membership.shape[0])
                      v1[com_membership[:, t] == n] = 1
                      v2[com_membership[:, t-1] == m] = 1
                      d[int(m)] = jaccard(v1, v2)
                  bestval = np.argmin(d)
              else:
                  bestval = new_index.max() + 1
              new_index[com_membership[:, t] == n] = bestval
              c1back = np.array(np.delete(c1back, np.where(c1back == bestval)))
          com_membership[:, t] = new_index
      return com_membership
docs: r"""
      Matches community labels accross time-points
  
      Jaccard matching is in a greedy fashiong. Matching the largest community at t with the community at t-1.
  
      Parameters
      ----------
  
      com_membership : array
          Shape should be node, time.
  
      Returns
      -------
  
      D : array
          temporal consensus matrix using Jaccard distance