public Graph()

in src/main/java/com/twitter/sbf/graph/Graph.java [60:85]


  public Graph(int numVertices, long numEdges, int[][] nbrs, float[][] wts) {
    this.numVertices = numVertices;
    this.numEdges = numEdges;
    this.neighbors = nbrs;
    this.weights = wts;
    if (isWeighted()) {
      double totalSum = 0;
      this.weightedOutDegrees = new float[this.numVertices];
      for (int i = 0; i < this.numVertices; i++) {
        this.weightedOutDegrees[i] = 0;
        for (int j = 0; j < this.weights[i].length; j++) {
          if (Float.isNaN(this.weights[i][j])) {
            throw new RuntimeException(
                "Weight from node " + i + " to node " + j + " (zero-indexed) is NaN!"
            );
          }
          this.weightedOutDegrees[i] += this.weights[i][j];
          totalSum += this.weights[i][j];
        }
      }
      // divide by 2 since each edge is present twice
      this.globalAvgWeight = totalSum / this.numEdges / 2;
    }
    checkSizesOfNbrsAndWts();
    checkSymmetryAndSorting();
  }