/** Gets the average degree of this matrix. */
  public double getAvgDegree() {
    double rowSums = 0;
    for (int i = 0; i < matrix.rows(); i++) {
      for (int j = 0; j < matrix.columns(); j++) {
        rowSums += matrix.get(i, j);
      }
    }

    return rowSums / matrix.rows();
  }
 /** Returns the number of rows int matrix. */
 public int rows() {
   return matrix.rows();
 }
 /** Gets (computes) the density of this matrix. */
 public double getDensity() {
   double sum = matrix.zSum();
   return sum / matrix.rows() * (matrix.rows() - 1);
 }