public Result doWork() {
        if (prepared)
            throw new IllegalStateException("Call doWork only once!");
        prepared = true;
        if (!graph.isFrozen()) {
            throw new IllegalStateException("Given BaseGraph has not been frozen yet");
        }
        if (chStore.getShortcuts() > 0) {
            throw new IllegalStateException("Given CHStore already contains shortcuts");
        }
        allSW.start();
        initFromGraph();
        runGraphContraction();
        allSW.stop();
        logFinalGraphStats();
        return new Result(
                chConfig, chStore,
                nodeContractor.getAddedShortcutsCount(),
                lazyUpdateSW.getCurrentSeconds(),
                periodicUpdateSW.getCurrentSeconds(),
                neighborUpdateSW.getCurrentSeconds(),
                allSW.getMillis()
        );
    }
@Test
    public void testAddShortcuts() {
        initExampleGraph(g, speedEnc);
        PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g);
        useNodeOrdering(prepare, new int[]{5, 3, 4, 0, 1, 2});
        PrepareContractionHierarchies.Result res = prepare.doWork();
        assertEquals(2, res.getShortcuts());
    }