use of org.opentripplanner.util.stats.DiscreteDistribution.LogQuantifiable in project OpenTripPlanner by opentripplanner.
the class GraphStatisticsModule method buildGraph.
@Override
public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
DiscreteDistribution<ConstantQuantifiable<String>> edgeTypeDistribution = new DiscreteDistribution<ConstantQuantifiable<String>>();
DiscreteDistribution<NumberQuantifiable<Integer>> edgeNameDistribution = new DiscreteDistribution<NumberQuantifiable<Integer>>();
DiscreteDistribution<NumberQuantifiable<Integer>> geomSizeDistribution = new DiscreteDistribution<NumberQuantifiable<Integer>>();
DiscreteDistribution<LogQuantifiable<Double>> geomLenDistribution = new DiscreteDistribution<LogQuantifiable<Double>>();
DiscreteDistribution<ConstantQuantifiable<String>> vertexTypeDistribution = new DiscreteDistribution<ConstantQuantifiable<String>>();
DiscreteDistribution<NumberQuantifiable<Integer>> vertexNameDistribution = new DiscreteDistribution<NumberQuantifiable<Integer>>();
DiscreteDistribution<NumberQuantifiable<Integer>> vertexLabelDistribution = new DiscreteDistribution<NumberQuantifiable<Integer>>();
for (Edge e : graph.getEdges()) {
edgeTypeDistribution.add(new ConstantQuantifiable<String>(e.getClass().toString()));
edgeNameDistribution.add(new NumberQuantifiable<Integer>(e.getName() == null ? 0 : e.getName().length()), e.getName());
if (e.getGeometry() != null) {
LineString geometry = e.getGeometry();
geomSizeDistribution.add(new NumberQuantifiable<Integer>(geometry.getNumPoints()));
double lenMeters = SphericalDistanceLibrary.fastLength(geometry);
geomLenDistribution.add(new LogQuantifiable<Double>(lenMeters, 5.0));
}
}
for (Vertex v : graph.getVertices()) {
vertexTypeDistribution.add(new ConstantQuantifiable<String>(v.getClass().toString()));
vertexNameDistribution.add(new NumberQuantifiable<Integer>(v.getName() == null ? 0 : v.getName().length()), v.getName());
vertexLabelDistribution.add(new NumberQuantifiable<Integer>(v.getLabel().length()), v.getLabel());
}
LOG.info("Geometry size distribution (linear scale, # points):\n" + geomSizeDistribution.toString());
LOG.info("Geometry length distribution (log scale, meters):\n" + geomLenDistribution.toString());
LOG.info("Edge type distribution:\n" + edgeTypeDistribution.toString());
LOG.info("Edge name distribution:\n" + edgeNameDistribution.toString());
LOG.info("Vertex type distribution:\n" + vertexTypeDistribution.toString());
LOG.info("Vertex name distribution:\n" + vertexNameDistribution.toString());
LOG.info("Vertex label distribution:\n" + vertexLabelDistribution.toString());
}
Aggregations