code: @Override
    public int[] calculateInDegrees() {
      final int[] in_degrees = new int[size()];
      for(int i = 0; i < size(); ++i) {
        final IAdjacencyListPair<TVertex> p = pairAt(i);
        final TVertex d = p.getVertex();
  
        for(int j = 0; j < size(); ++j) {
          for(IVertex dep : pairAt(j).getOutNeighbors()) {
            if (d.equals(dep))
              ++in_degrees[i];
          }
        }
      }
      return in_degrees;
    }
docs: Calculates an integer array where the value at each index is the number of times that vertex is
  referenced elsewhere.