nw:mean-path-length
nw:mean-path-length
Reports the average shortest-path length between all distinct pairs of nodes in the current context.
Reports false unless paths exist between all pairs.
Example:
links-own [ weight ]
to go
clear-all
create-turtles 3
ask turtle 0 [ create-link-with turtle 1 [ set weight 2.0 ] ]
ask turtle 1 [ create-link-with turtle 2 [ set weight 2.0 ] ]
show nw:mean-path-length
create-turtles 1 ; create a new, disconnected turtle
show nw:mean-path-length
end
Will ouput:
observer: 1.3333333333333333
observer: false
Take me to the full Networks Extension Dictionary