RosettaCodeData/Task/Dijkstras-algorithm/Uiua/dijkstras-algorithm.uiua

7 lines
287 B
Text
Raw Permalink Normal View History

2024-10-16 18:07:41 -07:00
# Use table of edge weights.
A ← [[0 7 9 0 0 14] [0 0 10 15 0 0] [0 0 0 11 0 2]
[0 0 0 0 6 0] [0 0 0 0 0 9][0 0 0 0 0 0]]
Ns ← ⍜⊟⍜⍉(▽⊸≡(≠0⊢)):°⊏⊡:A # Neighbours with costs.
2026-02-01 16:33:20 -08:00
P ← &p$"Path: _ with cost _"/$"_->_"+@a°□⊢path(Ns|≍)°⊟
2024-10-16 18:07:41 -07:00
≡P[0_4 0_5]