1. A method of reducing template matching in document image decoding incorporating a Stack algorithm, comprising: determining an upper bound for a weight for each of a plurality of possible edges that extend a partial path, the partial path having a weight, each of the plurality of possible edges extending the partial path to one of a plurality of possible next vertices in a Stack graph; determining a provisional weight for each of the extensions, the provisional weight including the weight of the partial path and the upper bound; and queuing the extensions according to their provisional weights.