app/src/main/java/org/jgrapht/alg/BellmanFordPathElement.java
protected boolean improve(
        BellmanFordPathElement<V, E> candidatePrevPathElement,
        E candidateEdge,
        double candidateCost)
    {
        // to avoid improvement only due to rounding errors.
        if (candidateCost < (getCost() - epsilon)) {
            this.prevPathElement = candidatePrevPathElement;
            this.prevEdge = candidateEdge;
            this.cost = candidateCost;
            this.nHops = candidatePrevPathElement.getHopCount() + 1;

            return true;
        } else {
            return false;
        }
    }
/**
     * Returns <code>true</code> if the path has been improved, <code>
     * false</code> otherwise. We use an "epsilon" precision to check whether
     * the cost has been improved (because of many roundings, a formula equal to
     * 0 could unfortunately be evaluated to 10^-14).
     *
     * @param candidatePrevPathElement
     * @param candidateEdge
     * @param candidateCost
     *
     * @return .
     */
Returns true if the path has been improved,
false otherwise. We use an "epsilon" precision to check whether
the cost has been improved (because of many roundings, a formula equal to
0 could unfortunately be evaluated to 10^-14).



@return .
Returns true if the path has been improved false otherwise . We use an " epsilon " precision to check whether the cost has been improved ( because of many roundings a formula equal to 0 could unfortunately be evaluated to 10^ - 14 ) . @return .
protected boolean improve(
        BellmanFordPathElement<V, E> candidatePrevPathElement,
        E candidateEdge,
        double candidateCost)
    {
        if (candidateCost < (getCost() - epsilon)) {
            this.prevPathElement = candidatePrevPathElement;
            this.prevEdge = candidateEdge;
            this.cost = candidateCost;
            this.nHops = candidatePrevPathElement.getHopCount() + 1;
            return true;
        } else {
            return false;
        }
    }
protected boolean improve ( BellmanFordPathElement < V , E > candidatePrevPathElement , E candidateEdge , double candidateCost ) { if ( candidateCost < ( getCost ( ) - epsilon ) ) { this . prevPathElement = candidatePrevPathElement ; this . prevEdge = candidateEdge ; this . cost = candidateCost ; this . nHops = candidatePrevPathElement . getHopCount ( ) + 1 ; return true ; } else { return false ; } }
Returns <code>true</code> if the path has been improved, <code>
 false</code> otherwise.
Returns <code > true< / code > if the path has been improved <code > false< / code > otherwise .
// to avoid improvement only due to rounding errors.