cvec ← wgraph ##.wcost path  ⍝ Cost vector for path ⍵ through weighted graph ⍺.

The  result,  [cvec]  is  the  cost-per-edge for the _path_ through the weighted
graph  [wgraph].  Note  that  the resulting cost vector has one fewer items than
the path.

Examples:

      disp aa                       ⍝ simple weighted graph.
┌→──┬─┬───┬───┬─┐ 
↓2 3│3│2 4│1 5│3│
├~─→┼─┼~─→┼~─→┼─┤ 
│1 3│1│4 1│1 1│1│
└~─→┴─┴~─→┴~─→┴─┘ 

      aa wcost 1 3 4 5 3 2 3 2      ⍝ cost of path through graph.
3 1 1 1 4 1 4

See also: wGraphs wspan wpath

Back to: contents

Back to: Dyalog APL

Trouble seeing APL font?