I'm not entirely sure what you mean by saving the links, but you can store the list of links in a variable. So, if you have a turtles-own variable path-to-destination
, you can just do
ask nodes with [label = "Source" ] [
set path-to-destination nw:weighted-path-to turtle nodenumberdestination "bandwidth"
]
Alternatively, you can just store the list of links in a local variable if you don't need to do anything with them later:
ask nodes with [label = "Source" ] [
let path-to-destination nw:weighted-path-to turtle nodenumberdestination "bandwidth"
]
As for turning them red, nw:weighted-path-to
returns a list of links, so we can just loop through that list ask each to become red. Extending the previous code, that looks like:
ask nodes with [label = "Source" ] [
let path-to-destination nw:weighted-path-to turtle nodenumberdestination "bandwidth"
foreach path-to-destination [ ask ? [ set color red ] ]
]