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 testBug178() {
        // 5--------6__
        // |        |  \
        // 0-1->-2--3--4
        //   \-<-/
        //
        g.edge(1, 2).setDistance(1).set(speedEnc, 60, 0);
        g.edge(2, 1).setDistance(1).set(speedEnc, 60, 0);

        g.edge(5, 0).setDistance(1).set(speedEnc, 60, 60);
        g.edge(5, 6).setDistance(1).set(speedEnc, 60, 60);
        g.edge(0, 1).setDistance(1).set(speedEnc, 60, 60);
        g.edge(2, 3).setDistance(1).set(speedEnc, 60, 60);
        g.edge(3, 4).setDistance(1).set(speedEnc, 60, 60);
        g.edge(6, 3).setDistance(1).set(speedEnc, 60, 60);

        PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g);
        useNodeOrdering(prepare, new int[]{4, 1, 2, 0, 5, 6, 3});
        PrepareContractionHierarchies.Result result = prepare.doWork();
        assertEquals(2, result.getShortcuts());
    }