我正在尝试调整(简单的)优先附件网络模型(可在Net徽标模型库中获得),以包括一个决定网络结构的滑块变量。根据优先依恋模型(或“意见领袖”模型)的理论,网络中的每个人都被分配了若干联系,k,根据分布p(k)∝k^−γ,并随机连接到这个数量的人。因此,我希望有一个滑块,我可以适应γ。
在原始代码的核心部分,随机选择合作伙伴和链接,如下所示:
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我有点不知道该如何包含这个参数。
有人能帮忙吗?
提前谢谢。
编辑:还是不能让这个工作。我已经做了一个‘正常’优先附件模型的设置,而不是去(再次改编自模型库)。但我仍然无法理解我应该如何调整这段代码来包含伽马参数。我的代码:
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我们非常感谢你的帮助!
发布于 2017-06-30 13:39:18
我想你已经错过了我最初评论的重点,在Barabasi-Albert (BA)算法中没有位置可以插入任何这样的参数。你需要用一种完全不同的方式建立网络。也就是说,您需要制定构建网络的方法、过程或算法,然后担心编写代码来实现该方法。
我认为您需要使用Dorogovtsev等人(2000年)中描述的具有优先连接的增长网络结构(如果有访问权限,请参见https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.85.4633 )。在BA算法中,为新节点附加的现有网络中的节点被选择的概率与程度成正比(或在您的问题中为k)。在扩展算法中,每个节点都有一个固有的吸引度A,选择的概率为A+k。
本文中的方程12描述了指数之间的关系(你的参数为: gamma =2+ A/m,其中m是出度(每个节点所附加的边数)。
https://stackoverflow.com/questions/44332789
复制相似问题