Consider a graph G with vertices V numbered 1 through N. Further consider a function shortestPath(i, j, k) that returns the shortest possible path from i to j using vertices only from the set {1,2,...,k} as intermediate points along the way.
พิจารณาที่กราฟ G ที่มียอด V เลข 1 ถึง N .เพิ่มเติมให้พิจารณาที่ฟังก์ชัน shortestpath ( I , J , K )ที่จะกลับมาที่สั้นที่สุดเท่าที่เป็นไปได้พาธจากผมไป J โดยใช้ยอดเท่านั้นจากที่ตั้งค่า {1,2, ..., K }เป็นกลางจุดตามเส้นทางจะได้