@Override public void foundShortcut( int u_fromNode, int w_toNode, double existingDirectWeight, EdgeIterator outgoingEdges, int skippedEdge1, int incomingEdgeOrigCount) { // FOUND shortcut // but be sure that it is the only shortcut in the collection // and also in the graph for u->w. If existing AND identical weight => update setProperties. // Hint: shortcuts are always one-way due to distinct level of every node but we don't // know yet the levels so we need to determine the correct direction or if both directions // minor improvement: if (shortcuts.containsKey(sc) // then two shortcuts with the same nodes (u<->n.endNode) exists => check current shortcut // against both Shortcut sc = new Shortcut(u_fromNode, w_toNode, existingDirectWeight); if (shortcuts.containsKey(sc)) { return; } else { Shortcut tmpSc = new Shortcut(w_toNode, u_fromNode, existingDirectWeight); Shortcut tmpRetSc = shortcuts.get(tmpSc); if (tmpRetSc != null) { tmpRetSc.flags = scBothDir; return; } } shortcuts.put(sc, sc); sc.skippedEdge1 = skippedEdge1; sc.skippedEdge2 = outgoingEdges.getEdge(); sc.originalEdges = incomingEdgeOrigCount + getOrigEdgeCount(outgoingEdges.getEdge()); }