コード例 #1
0
  /** 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();
  }
コード例 #2
0
 /** Returns the number of rows int matrix. */
 public int rows() {
   return matrix.rows();
 }
コード例 #3
0
 /** Gets (computes) the density of this matrix. */
 public double getDensity() {
   double sum = matrix.zSum();
   return sum / matrix.rows() * (matrix.rows() - 1);
 }