public double getCount(int value) { return counts.get(value); }
public double getCount(int value) { return counts.get(value); }
public void addValue(int value, double amount) { counts.put(value, amount + counts.get(value)); total += amount; }
public void addValue(int value, double amount) { counts.put(value, amount + counts.get(value)); total += amount; }
public double getCount(int value) { return counts.get(value); }
public double getCount(int value) { return counts.get(value); }
public double combinedStdDev(int hour) { if(stats1.hourCount.get(hour) == 0 || stats2.hourCount.get(hour) == 0) return Double.NaN; double stdDev1 = stats1.getStdDev(hour); double stdDev2 = stats1.getStdDev(hour); double stdDevSample1 = Math.pow(stdDev1, 2) / stats1.hourCount.get(hour); double stdDevSample2 = Math.pow(stdDev2, 2) / stats2.hourCount.get(hour); double combinedStdDevSample = stdDevSample1 + stdDevSample2; return Math.sqrt(combinedStdDevSample); }
public void addValue(int value, double amount) { counts.put(value, amount + counts.get(value)); total += amount; }
public void addValue(int value, double amount) { counts.put(value, amount + counts.get(value)); total += amount; }
public Stream<Result> resultStream() { return StreamSupport.stream(shortestPath.spliterator(), false) .map(cursor -> new Result(graph.toOriginalNodeId(cursor.value), gCosts.get(cursor.value))); }
public Stream<Result> resultStream() { return StreamSupport.stream(shortestPath.spliterator(), false) .map(cursor -> new Result(graph.toOriginalNodeId(cursor.value), gCosts.get(cursor.value))); }
private void removeWeightForSelfRelationships(int node, IntDoubleMap communityWeights) { graph.forEachRelationship(node, D, (s, t, r) -> { if(s == t) { double currentWeight = communityWeights.get(localCommunities[s]); communityWeights.put(localCommunities[s], currentWeight - graph.weightOf(s, t)); } return true; }); }
/** * compute shortest path from sourceNode to targetNode * @param sourceNode mapped source node id * @param targetNode mapped target node id * @param maxDepth maximum traversal depth * @return an optional path */ public Optional<WeightedPath> compute(int sourceNode, int targetNode, int maxDepth) { if (!dijkstra(sourceNode, targetNode, direction, maxDepth)) { return Optional.empty(); } int last = targetNode; final WeightedPath resultPath = new WeightedPath(INITIAL_CAPACITY); while (last != PATH_END) { resultPath.append(last); last = path.getOrDefault(last, PATH_END); } return Optional.of(resultPath .withWeight(costs.get(targetNode)) .reverse()); }
/** * compute shortest path from sourceNode to targetNode * @param sourceNode mapped source node id * @param targetNode mapped target node id * @param maxDepth maximum traversal depth * @return an optional path */ public Optional<WeightedPath> compute(int sourceNode, int targetNode, int maxDepth) { if (!dijkstra(sourceNode, targetNode, direction, maxDepth)) { return Optional.empty(); } int last = targetNode; final WeightedPath resultPath = new WeightedPath(INITIAL_CAPACITY); while (last != PATH_END) { resultPath.append(last); last = path.getOrDefault(last, PATH_END); } return Optional.of(resultPath .withWeight(costs.get(targetNode)) .reverse()); }