stpath←{                ⍝ Path through spanning tree ⍺ to vertex ⍵.
    tree←⍺              ⍝ (partial) spanning tree.
    ⍬{                  ⍝ path accumulator.
        ⍵<0:(⍵=¯2)↓⍺    ⍝ root or unvisited vertex: finished.
        (⍵,⍺)∇ ⍵⊃tree   ⍝ otherwise: prefix previous (parent) vertex.
    }⍵
}
code_colours

test script

Back to: notes

Back to: Workspaces