การเขียนโปรแกรม ของ ขั้นตอนวิธีของฟลอยด์-วอร์แชล

การเขียนโปรแกรม สามารถทำได้หลายภาษามากมาย en:programming language.


D ( 0 ) = ( 0 3 8 ∞ − 4 ∞ 0 ∞ 1 7 ∞ 4 0 ∞ ∞ 2 ∞ − 5 0 ∞ ∞ ∞ ∞ 6 0 ) Π ( 0 ) = ( NIL 1 1 NIL 1 NIL NIL NIL 2 2 NIL 3 NIL NIL NIL 4 NIL 4 NIL NIL NIL NIL NIL 5 NIL ) D ( 1 ) = ( 0 3 8 ∞ − 4 ∞ 0 ∞ 1 7 ∞ 4 0 ∞ ∞ 2 5 − 5 0 − 2 ∞ ∞ ∞ 6 0 ) Π ( 1 ) = ( NIL 1 1 NIL 1 NIL NIL NIL 2 2 NIL 3 NIL NIL NIL 4 1 4 NIL 1 NIL NIL NIL 5 NIL ) D ( 2 ) = ( 0 3 8 4 − 4 ∞ 0 ∞ 1 7 ∞ 4 0 5 11 2 5 − 5 0 − 2 ∞ ∞ ∞ 6 0 ) Π ( 2 ) = ( NIL 1 1 2 1 NIL NIL NIL 2 2 NIL 3 NIL 2 2 4 1 4 NIL 1 NIL NIL NIL 5 NIL ) D ( 3 ) = ( 0 3 8 4 − 4 ∞ 0 ∞ 1 7 ∞ 4 0 5 11 2 − 1 − 5 0 − 2 ∞ ∞ ∞ 6 0 ) Π ( 3 ) = ( NIL 1 1 2 1 NIL NIL NIL 2 2 NIL 3 NIL 2 2 4 3 4 NIL 1 NIL NIL NIL 5 NIL ) D ( 4 ) = ( 0 3 − 1 4 − 4 3 0 − 4 1 − 1 7 4 0 5 3 2 − 1 − 5 0 − 2 8 5 1 6 0 ) Π ( 4 ) = ( NIL 1 4 2 1 4 NIL 4 2 1 4 3 NIL 2 1 4 3 4 NIL 1 4 3 4 5 NIL ) D ( 5 ) = ( 0 1 − 3 2 − 4 3 0 − 4 1 − 1 7 4 0 5 3 2 − 1 − 5 0 − 2 8 5 1 6 0 ) Π ( 5 ) = ( NIL 3 4 5 1 4 NIL 4 2 1 4 3 NIL 2 1 4 3 4 NIL 1 4 3 4 5 NIL ) {\displaystyle {\begin{aligned}&D^{(0)}={\begin{pmatrix}0&3&8&\infty &-4\\\infty &0&\infty &1&7\\\infty &4&0&\infty &\infty \\2&\infty &-5&0&\infty \\\infty &\infty &\infty &6&0\end{pmatrix}}\quad &\Pi ^{(0)}={\begin{pmatrix}{\text{NIL}}&1&1&{\text{NIL}}&1\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&2&2\\{\text{NIL}}&3&{\text{NIL}}&{\text{NIL}}&{\text{NIL}}\\4&{\text{NIL}}&4&{\text{NIL}}&{\text{NIL}}\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&5&{\text{NIL}}\end{pmatrix}}\\\\&D^{(1)}={\begin{pmatrix}0&3&8&\infty &-4\\\infty &0&\infty &1&7\\\infty &4&0&\infty &\infty \\2&5&-5&0&-2\\\infty &\infty &\infty &6&0\end{pmatrix}}&\Pi ^{(1)}={\begin{pmatrix}{\text{NIL}}&1&1&{\text{NIL}}&1\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&2&2\\{\text{NIL}}&3&{\text{NIL}}&{\text{NIL}}&{\text{NIL}}\\4&1&4&{\text{NIL}}&1\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&5&{\text{NIL}}\end{pmatrix}}\\\\&D^{(2)}={\begin{pmatrix}0&3&8&4&-4\\\infty &0&\infty &1&7\\\infty &4&0&5&11\\2&5&-5&0&-2\\\infty &\infty &\infty &6&0\end{pmatrix}}&\Pi ^{(2)}={\begin{pmatrix}{\text{NIL}}&1&1&2&1\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&2&2\\{\text{NIL}}&3&{\text{NIL}}&2&2\\4&1&4&{\text{NIL}}&1\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&5&{\text{NIL}}\end{pmatrix}}\\\\&D^{(3)}={\begin{pmatrix}0&3&8&4&-4\\\infty &0&\infty &1&7\\\infty &4&0&5&11\\2&-1&-5&0&-2\\\infty &\infty &\infty &6&0\end{pmatrix}}&\Pi ^{(3)}={\begin{pmatrix}{\text{NIL}}&1&1&2&1\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&2&2\\{\text{NIL}}&3&{\text{NIL}}&2&2\\4&3&4&{\text{NIL}}&1\\{\text{NIL}}&{\text{NIL}}&{\text{NIL}}&5&{\text{NIL}}\end{pmatrix}}\\\\&D^{(4)}={\begin{pmatrix}0&3&-1&4&-4\\3&0&-4&1&-1\\7&4&0&5&3\\2&-1&-5&0&-2\\8&5&1&6&0\end{pmatrix}}&\Pi ^{(4)}={\begin{pmatrix}{\text{NIL}}&1&4&2&1\\4&{\text{NIL}}&4&2&1\\4&3&{\text{NIL}}&2&1\\4&3&4&{\text{NIL}}&1\\4&3&4&5&{\text{NIL}}\end{pmatrix}}\\\\&D^{(5)}={\begin{pmatrix}0&1&-3&2&-4\\3&0&-4&1&-1\\7&4&0&5&3\\2&-1&-5&0&-2\\8&5&1&6&0\end{pmatrix}}&\Pi ^{(5)}={\begin{pmatrix}{\text{NIL}}&3&4&5&1\\4&{\text{NIL}}&4&2&1\\4&3&{\text{NIL}}&2&1\\4&3&4&{\text{NIL}}&1\\4&3&4&5&{\text{NIL}}\end{pmatrix}}\end{aligned}}} D[k] และ n[k] เมื่อ กราฟถูกคำนวณด้วยขั้นตอนวิธีนี้

ใกล้เคียง

ขั้นตอนวิธีแบบยุคลิด ขั้นตอนวิธีการค้นหาเพื่อนบ้านใกล้สุด k ตัว ขั้นตอนวิธีของฟลอยด์-วอร์แชล ขั้นตอนวิธีของควิน-แม็กคลัสกีย์ ขั้นตอนวิธีฮังกาเรียน ขั้นตอนวิธี ขั้นตอนวิธีของชอร์ ขั้นตอนวิธีเชิงพันธุกรรม ขั้นตอนวิธีโบรน-เคอร์โบสท์ ขั้นตอนวิธีของไดก์สตรา

แหล่งที่มา

WikiPedia: ขั้นตอนวิธีของฟลอยด์-วอร์แชล http://quickgraph.codeplex.com/ http://www.codeplex.com/quickgraph http://www.cplusplus.happycodings.com/Algorithms/c... http://julmis.julmajanne.com/index.php/FloydWarsha... http://www.mathworks.com/matlabcentral/fileexchang... http://www.microshell.com/programming/computing-de... http://www.microshell.com/programming/floyd-warsha... http://tide4javascript.com/?s=Floyd http://www.youtube.com/watch?v=Cadt4OYXpJQ http://www.youtube.com/watch?v=Sygq1e0xWnM