private void checkSizesOfNbrsAndWts()

in src/main/java/com/twitter/sbf/graph/Graph.java [245:268]


  private void checkSizesOfNbrsAndWts() {
    if (this.neighbors != null) {
      int numNeighbors = 0;
      for (int[] arr : this.neighbors) {
        numNeighbors += arr.length;
      }
      assert numNeighbors == this.numEdges * 2
          : String.format(
              "Expected size of neighbors %d, actual size of neighbors %d",
                this.numEdges * 2, numNeighbors
            );
    }
    if (this.weights != null) {
      int numNeighbors = 0;
      for (float[] arr : this.weights) {
        numNeighbors += arr.length;
      }
      assert numNeighbors == this.numEdges * 2
          : String.format(
              "Expected size of weights %d, actual size of weights %d",
                this.numEdges * 2, numNeighbors
            );
    }
  }