nw:load-matrix
nw:load-matrix file-name turtle-breed link-breed optional-command-block
Generates a new network according to the connection matrix saved in file-name, using turtle-breed and link-breed to create the new turtles and links.
At the moment, nw:load-matrix
does not support link weights.
Please be aware that the breeds used to load the matrix may be different from those that you used when you saved it.
For example:
extensions [ nw ]
directed-link-breed [ dirlinks dirlink ]
to go
clear-all
crt 5 [ create-dirlinks-to other turtles ]
nw:set-context turtles dirlinks
nw:save-matrix "matrix.txt"
clear-all
nw:load-matrix "matrix.txt" turtles links
layout-circle turtles 10
end
…will give you back undirected links, even if you saved directed links into the matrix.
If you specify an optional-command-block, it is executed for each turtle in the newly created network. For example:
nw:load-matrix "matrix.txt" turtles links [ set color red ]
Take me to the full Networks Extension Dictionary