code: def calculate_densities(self):
          
          active = self.active
          densities = defaultdict(int)
          for (at, bt), links in self.contacts.items():
              if not (at in active and bt in active):
                  continue
              densities[at] += links
              densities[bt] += links
  
          logdensities = {}
          for x, d in densities.items():
              s = self.tig_to_size[x]
              logd = np.log10(d * 1. / min(s, 500000))
              logdensities[x] = logd
  
          return logdensities
docs: Calculate the density of inter-contig links per base. Strong contigs
          considered to have high level of inter-contig links in the current
          partition.