我尝试使用nw扩展中的Kleinberg模型生成图形:
nw:generate-small-world turtles links 4 4 2 false
然后我根据2D格子中的ID属性(“who”)对所有节点进行了排序:
但Kleinberg模型不应该生成连接到所有4个邻居的节点吗?也许节点ID是随机顺序的?或者我的Kleinberg模型错了?
答案 0 :(得分:2)
Kleinberg模型正在发挥作用。您观察到的行为是由于海龟与其他海龟建立联系的随机顺序。在Netlogo中,海龟将以随机顺序执行功能。您可以指定创建有序代理集,但是默认情况下期望ID(“who”)处于随机顺序。您可以在命令中心中键入以下两个命令,以便在生成Kleinberg网络后进行简单而相关的演示:
ask turtles [show who]
ask turtles [show [who] of link-neighbors]
这些将返回如下输出:
observer> ask turtles [show who]
(turtle 0): 0
(turtle 5): 5
(turtle 9): 9
(turtle 2): 2
(turtle 12): 12
(turtle 14): 14
(turtle 10): 10
(turtle 15): 15
(turtle 4): 4
(turtle 13): 13
(turtle 3): 3
(turtle 7): 7
(turtle 6): 6
(turtle 1): 1
(turtle 8): 8
(turtle 11): 11
observer> ask turtles [show [who] of link-neighbors]
(turtle 9): [13 7 14 1]
(turtle 10): [1 12 15 4 2]
(turtle 13): [2 14 8 9 11]
(turtle 15): [10 7 3 4 6 14 12]
(turtle 3): [4 12 11 8 5 15]
(turtle 14): [9 15 7 13]
(turtle 2): [4 10 13]
(turtle 6): [0 5 15]
(turtle 4): [3 12 2 10 15 5]
(turtle 7): [0 8 14 9 1 12 15]
(turtle 1): [10 9 8 11 7]
(turtle 8): [0 13 3 7 1]
(turtle 11): [0 1 3 13]
(turtle 5): [4 3 0 6]
(turtle 0): [11 8 5 6 7]
(turtle 12): [15 3 10 4 7]
请注意响应命令的turtles
的随机顺序,以及link-neighbors
的顺序