public double deltaCostForReplace(Integer sourceNode, Integer targetNode) {
        if (   steps.contains(targetNode)
            || !steps.contains(sourceNode)) {
            throw new IllegalArgumentException("path doesn't contain 'sourceNode' or path already contains 'targetNode'");
        }
        int position = getPositionByNodeIndex(sourceNode);
        Integer start = (position == 0) ? 0 : steps.get(position - 1);
        Integer end = (position == steps.size() - 1) ? 0 : steps.get(position + 1);
        return    graph.getEdge(start, targetNode).getCost()
                + graph.getEdge(targetNode, end).getCost()
                - graph.getEdge(start, sourceNode).getCost()
                - graph.getEdge(sourceNode, end).getCost();
    }