Netlogo:在运行时创建小世界网络

时间:2018-01-18 10:53:40

标签: network-programming netlogo

我正在尝试在我的Netlogo模型中生成一个小世界类型的网络(https://en.wikipedia.org/wiki/Small-world_network),该模型在整个模型本身中创建;当模型运行时,人们会相互了解。

我知道如何在设置中在Netlogo中生成一个小型世界模型。但是,如何在旅途中生成小型世界网

我在设置过程中生成小世界的代码如下。

breed [interlinks interlink] ;links between different breeds
breed [intralinks intralink] ; links between same breeds

to set_sw_network
  ask turtles[
    let max-who 1 + max [who] of turtles
    let sorted sort ([who] of turtles)
    foreach sorted [ x ->
      ask turtle x [
        let i 1
        repeat same_degree + dif_degree [
          ifelse [breed] of self = [breed] of turtle (( x + i ) mod max-who)
            [create-intralink-with turtle (( x + i ) mod max-who)]
            [create-interlink-with turtle (( x + i) mod max-who)]
          set i i + 1
        ]
      ]
    ]
      repeat round (rewire_prop * number_of_members) [    ;rewire_prop is a slider 0 - 1 with steps of 0.1
        ask one-of turtles [
          ask one-of my-links [die]
          create-intralink-with one-of other turtles with [link-with self = nobody]
        ]
      ]
  ]
end

但是,我一开始并不想创造一个小世界。我有兴趣在整个模型中创建一个具有小世界属性的网络。目前,我在我的模型中有这个随时随地创建链接功能,但我不确定如何调整它,因此它会产生一个小型的世界类型的网络:

to select_interaction:
  ommitted code: sorts pre-existing links and interacts with them
  if count my-links < my_degree
  [
    repeat number_of_interactions_per_meeting
    [
      let a select_turtle  ;delivers a turtle with link to self = nobody
      if a != nobody
      [
        ifelse [breed] of a = [breed] of myself
        [
          create-intralink-with a
          [
            set color cyan
            interact
          ]
        ]
        [
          create-interlink-with a
          [
            set color orange + 2
            interact
          ]
        ]
      ]
   ]
  ]
end

目前,我的策略是为每个海龟提供my_degree的变量,该变量基于给定社交网络的分布。但问题仍然存在,如果这是一个好的策略,那么小世界网络的正确分布是什么?

此策略的伪代码:

to setup-turtles
  If preferential attachment: set my_degree random-poisson 'mean'
  If small world: set my_degree ????? 'mean'
end

任何见解都会很棒。

0 个答案:

没有答案