public double getWeightStandardDeviation()

in src/main/java/com/twitter/sbf/graph/Graph.java [183:201]


  public double getWeightStandardDeviation() {
    if (!isWeighted()) {
      return 0;
    }
    //Compute average
    double avgWeight = this.getGlobalAvgWeight();
    //iterate through all edges and sum up the squares of the deviations
    double deviationSquareSums = 0.0;
    for (float[] weightList: this.weights) {
      for (float wt: weightList) {
        deviationSquareSums += Math.pow(wt - avgWeight, 2.0);
      }
    }
    double variance = 0.0;
    if (this.getNumEdges() > 1) {
      variance = deviationSquareSums / (this.getNumEdges() - 1);
    }
    return Math.sqrt(variance);
  }