nw:weighted-path-to
nw:weighted-path-to target-turtle weight-variable
Like nw:path-to
, but takes link weight into account.
Example:
links-own [ weight ]
to go
clear-all
create-turtles 5
ask turtle 0 [ create-link-with turtle 1 [ set weight 2.0 ] ]
ask turtle 1 [ create-link-with turtle 2 [ set weight 2.0 ] ]
ask turtle 0 [ create-link-with turtle 3 [ set weight 0.5 ] ]
ask turtle 3 [ create-link-with turtle 4 [ set weight 0.5 ] ]
ask turtle 4 [ create-link-with turtle 2 [ set weight 0.5 ] ]
ask turtle 0 [ show nw:weighted-path-to turtle 2 weight ]
end
Will output:
(turtle 0): [(link 0 3) (link 3 4) (link 2 4)]
Take me to the full Networks Extension Dictionary