graph ← graph ##.inslink (from to)          ⍝ Insert edge ⍵ in graph ⍺.

[inslink]  takes  an  unweighted  graph as left argument and returns a new graph
with an extra edge defined by the right argument pair.

Examples:

    a                                   ⍝ graph "a".
┌───┬─┬───┬───┬─┐
│2 3│3│2 4│1 5│3│
└───┴─┴───┴───┴─┘

    a inslink 5 1                       ⍝ ··· with new link 5→1
┌───┬─┬───┬───┬───┐
│2 3│3│2 4│1 5│3 1│
└───┴─┴───┴───┴───┘

    a inslink foldl (5 1) (3 5)         ⍝ insert links: 5→1, 3→5.
┌───┬─┬─────┬───┬───┐
│2 3│3│2 4 5│1 5│3 1│
└───┴─┴─────┴───┴───┘

See also: Graphs remlink insnode

Back to: contents

Back to: Workspaces