@Override public void analyze(Graph g, Map<String, DescriptiveStatistics> statsMap) { int sumMale = 0; int cntMale = 0; int sumFemale = 0; int cntFemale = 0; TObjectDoubleHashMap<Vertex> values = module.values(g.getVertices()); TObjectDoubleIterator<Vertex> it = values.iterator(); for (int i = 0; i < values.size(); i++) { it.advance(); SocialVertex v = (SocialVertex) it.key(); double k = it.value(); if (v.getPerson().getPerson().getSex() != null) { if (v.getPerson().getPerson().getSex().equalsIgnoreCase("m")) { sumMale += k; cntMale++; } else if (v.getPerson().getPerson().getSex().equalsIgnoreCase("f")) { sumFemale += k; cntFemale++; } } } double k_mean_male = sumMale / (double) cntMale; double k_mean_female = sumFemale / (double) cntFemale; logger.info( String.format("k_mean_male = %1$s, k_mean_female = %2$s.", k_mean_male, k_mean_female)); }
@SuppressWarnings("unchecked") public PajekClusteringColorizer(Graph g) { super(); clustering = Transitivity.getInstance().localClusteringCoefficients((Set<V>) g.getVertices()); c_min = StatUtils.min(clustering.getValues()); c_max = StatUtils.max(clustering.getValues()); }