wcost←{ ⍝ Cost vector for path ⍵ through weighted graph ⍺. graph costs←↓⍺ ⍝ edges and edge-costs. 2>≢⍵:0 ⍝ null path: no cost. 2{ ⍝ ⍺:from, ⍵:to. node←,⍺⊃graph ⍝ exits from vertex. indx←node⍳⍵ ⍝ index of (⍺ ⍵) vertex. indx⊃,⍺⊃costs ⍝ ... associated cost. }/⍵ ⍝ pairwise along path. } code_colours test script Back to: notes Back to: Workspaces