simulation - How does the `find-partner` procedure in Preferential Attachment work? -
i have netlogo model has separate procedures set both small world , erdos-renyi network. user can specify network create , number of nodes each of these using sliders specify numbers of each breed want e,g erdos renyi network...
my model used simulate spread of measles through network
setup-erdos-renyi clear-all ;; make circle of turtles set num-nodes (num-children + num-adults + num-toddlers) create-children num-children create-adults num-adults create-toddlers num-toddlers layout-circle turtles (max-pxcor - 8) ;; give each pair of turtles equal chance ;; of creating link ask turtles [ ;; use "self > myself" here each pair of turtles ;; considered once create-links-with turtles [self > myself , random-float 1.0 < probability] ] setup infect-initial ask links [set closed? false] display reset-ticks end
what i'd implement option simulate preferential attachment between these turtles.
i've been looking @ supplied preferential attachment model comes in built in netlogo, i'm having hard time applying model. struggling understand how
to-report find-partner report [one-of both-ends] of one-of links end
this snippet serves find each node partners in example model, based on number of links mode has causing preferential attachment?
i believe 1 solution seed random set of links use snippet create more links pre determined number of links.
of snippet of code:
to-report find-partner report [one-of both-ends] of one-of links end
you asked "is based on number of links node has causing preferential attachment?"
the answer yes. understanding why bit subtle. instead of picking node directly first pick random link, , use lead node. why work?
well, example, suppose node has 100 links connected it, node b has 1 link connected it. if pick link @ random, it's 100 times likelier we'll pick link connected a, link connected b. , that's our goal — node's chance of being picked proportional link count.
Comments
Post a Comment