Preferential Attachement Netlogo

夙愿已清 提交于 2019-12-12 04:18:03

问题


I'm trying to adapt the (simple) Preferential Attachment Network model (available in the Netlogo Models library) to include a slider variable that determines network structure. According to the theory of the Preferential Attachment model (or 'Opinion Leader' model) each individual in the network is assigned a number of ties, k, according to the distribution p(k) ∝ k^−γ, and connected randomly to this number of people. I thus want to have a slider for which i can adapt γ.

In the heart of the original code partners and links are chosen randomly, as such:

to go
  if count turtles > num-nodes [ stop ]
  ;; choose a partner attached to a random link
  ;; this gives a node a chance to be a partner based on how many links it has
  ;; this is the heart of the preferential attachment mechanism
  let partner one-of [both-ends] of one-of links
  ;; create new node, link to partner
  create-turtles 1 [
    set color red
    ;; move close to my partner, but not too close -- to enable nicer looking networks
    move-to partner
    fd 1
    create-link-with partner
  ]
  ;; lay out the nodes with a spring layout
  layout
  tick
end

I'm a bit lost on how I should include this parameter.

Anyone who could help?

Thanks in advance.

EDIT: still can't get this to work. I got as far as making a 'normal' preferential attachment model in setup rather than go (again adapted from the models library). But still can't get my head around how I should adapt this code to include the gamma parameter. My code:

to create-new-nodes [n]
    clear-all
    ask patches [ set pcolor white ]
    create-nodes n [
    set color red
    set shape "circle"
  ]

    reset-ticks
end

to wire-pref-attach
  create-new-nodes 2 ; create the first two nodes (0 and 1)
  ask node 0 [ create-edge-with node 1] ; link them together
  create-nodes num-nodes - 2 [
    create-edge-with [one-of both-ends] of one-of edges ; pref select old node with more links
    set color red
    set shape "circle"
  ]
  radial-layout

end

to radial-layout
  layout-radial nodes edges (node 0)
end

Help is very much appreciated!


回答1:


I think you have missed the point of my original comment, there is no place in the Barabasi-Albert (BA) algorithm to insert any such parameter. You need to build the network in an entirely different way. That is, you need to work out the method or process or algorithm for building the network, and then worry about writing the code to implement that method.

I think you need the algorithm described in Dorogovtsev et al (2000) Structure of Growing Networks with Preferential Linking (see https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.85.4633 if you have access). In the BA algorithm, the nodes in the existing network for the new node to attach to are selected with probability proportional to in-degree (or k in your question). In the extended algorithm, each node has an inherent attractiveness A and the probability of selection is instead A+k.

Equation 12 in the paper describes the relationship between the exponent (your parameter gamma as: gamma = 2 + A/m where m is the out-degree (the number of edges being attached with each node).



来源:https://stackoverflow.com/questions/44332789/preferential-attachement-netlogo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!