@Override public int getEdges() { return getAllEdges().length(); }
@Override public void prepareContraction() { // todo: initializing meanDegree here instead of in initFromGraph() means that in the first round of calculating // node priorities all shortcut searches are cancelled immediately and all possible shortcuts are counted because // no witness path can be found. this is not really what we want, but changing it requires re-optimizing the // graph contraction parameters, because it affects the node contraction order. // when this is done there should be no need for this method any longer. meanDegree = prepareGraph.getAllEdges().length() / prepareGraph.getNodes(); }
void setOrigEdgeCount(int edgeId, int value) { edgeId -= maxEdgesCount; if (edgeId < 0) { // ignore setting as every normal edge has original edge count of 1 if (value != 1) throw new IllegalStateException("Trying to set original edge count for normal edge to a value = " + value + ", edge:" + (edgeId + maxEdgesCount) + ", max:" + maxEdgesCount + ", graph.max:" + prepareGraph.getAllEdges().length()); return; } long tmp = (long) edgeId * 4; originalEdges.ensureCapacity(tmp + 4); originalEdges.setInt(tmp, value); }
@Override public void doSpecificWork() { allSW.start(); initFromGraph(); runGraphContraction(); logger.info("took:" + (int) allSW.stop().getSeconds() + "s " + ", new shortcuts: " + nf(nodeContractor.getAddedShortcutsCount()) + ", initSize:" + nf(initSize) + ", " + prepareWeighting + ", periodic:" + params.getPeriodicUpdatesPercentage() + ", lazy:" + params.getLastNodesLazyUpdatePercentage() + ", neighbor:" + params.getNeighborUpdatePercentage() + ", " + getTimesAsString() + ", lazy-overhead: " + (int) (100 * ((checkCounter / (double) initSize) - 1)) + "%" + ", " + Helper.getMemInfo()); int edgeCount = ghStorage.getAllEdges().length(); logger.info("graph now - num edges: {}, num nodes: {}, num shortcuts: {}", nf(edgeCount), nf(ghStorage.getNodes()), nf(prepareGraph.getAllEdges().length() - edgeCount)); }