利用本地集群扩展免费网络

时间:2019-12-22 20:27:02

标签: netlogo

我正在尝试使用本地集群构建无规模网络,但是我无法设置本地集群条件。 局部聚类系数应定义为“ 其邻居集合中现有边的数量除以它们之间可能的连接总数”。

另一种思考方式是,顶点的两个随机选择的邻居本身就是邻居的可能性。

在我的模型中,有两个品种,我使用Netlogo中预先存在的模型实现了无标度网络,如下所示:

breed [ cats cat ]
breed [ dogs dog ]

cats-own [ already-attached ]
dogs-own [ already-attached ]



to setup-scale-free-network

  clear-all
  let num-cats 1000
  let num-dogs num-cats / 10
  let probability 1

  create-cats num-cats [ set color blue ]
  create-dogs num-dogs  [ set color red ]


  layout-circle turtles (max-pxcor - 8)
  ask turtles
  [
    create-links-with turtles with [self > myself and random-float 5 < probability]
  ]

end


to go
  setup-scale-free-network
  ask turtles with [already-attached = 0]
  [
    attach-to-one-of-each-breed self
  ]
end

to attach-to-one-of-each-breed [ source-node ]
  ask source-node
    [
      if any? other cats with [ already-attached = 0 ]
      [
        ask one-of other cats
        [
          set already-attached 1
          create-link-with source-node [ set color green ]
        ]
      ]

      if any? other dogs with [ already-attached = 0 ]
      [
        ask one-of other dogs
        [
          set already-attached 1
          create-link-with source-node [ set color green ]
        ]
      ]
    ]
end

我需要帮助来了解如何在此或不同规模的免费网络中实施本地集群条件,希望您能(一点)帮助我解决这个问题。

0 个答案:

没有答案