We will explain how Algorithm 1 works. In lines 1 and 2, the admissible vertex set and the length of the sliding window length for each contour point are calculated. In line 3, the rate for encoding the starting point of the contour is assigned to the rate of the first polygon vertex, and the rate for reaching any of the admissible vertex is set to infinity. The “for loops” in lines 4 and 5 select the start vertex of a polygon edge and the “for loops” in lines 6 and 7 select its end vertex within the sliding window of the start vertex. The lines 8–10 are used to calculate the edge distortion and the edge rate, by which the edge weight can be determined. The most important part of this algorithm is the comparison in line 11. Here, it tests whether the new minimum rate, , to reach admissible vertex , given that the last vertex was , is smaller than the smallest minimum rate used so far to reach , . If this minimum rate is indeed smaller, then it is assigned as the new smallest minimum rate to reach admissible vertex , , and the back pointer of , is assigned to point to since this is the previous vertex used to achieve . This algorithm leads to the optimal solution because when the rate of a vertex is given, then the selection of the future vertices , is independent of the selection of the past vertices , .