【发布时间】:2018-05-17 07:11:10
【问题描述】:
我得到了一组相互连接的海龟。我想检索两个节点之间链接的权重,我尝试过搜索,但找不到任何有关如何执行此操作的信息。我没有使用 nw 因为我不想要最短路径。有任何想法吗?这是我的代码的一部分:
to calculate-oldpath
let oldList [ 25 0 1 2 3 4 9 8 7 6 5 10 11 12 13 14 19 18 17 16 15 20 21 22 23 24]
let weighted-dist 0
( foreach ( but-last oldList ) ( but-first oldList ) [
[ a b ] ->
ask turtle a [
let node-link link-with turtle b
;Then retrieve weight link to do adding
]
] )
print weighted-dist
end
S 是我的起点(列表中的 25),E 是终点(列表中的 24)我想计算这条“橙色路径”的权重
【问题讨论】:
标签: netlogo