BehaviourComposer: ignore everything before this. Begin micro-behaviour Begin description: Create a social network where the number of bi-directional links each member has follows a normal distribution. End description Normal distribution social network Begin NetLogo code: substitute-text-area-for average-acquaintance-count-in-normal-symmetric-network 4substitute-text-area-for community-expression all-individualsdo-after-setup [let average-acquaintance-count average-acquaintance-count-in-normal-symmetric-network output-print (word "Initialising the social network so everyone has an average of " average-acquaintance-count " acquaintances with a normal distribution.") let entire-community community-expression let total-population count entire-community if total-population < average-acquaintance-count + 1 [output-print (word "Too small a population to create " average-acquaintance-count " average number of links.") stop] let total-links round (0.5 * average-acquaintance-count * total-population) repeat total-links [let a one-of entire-community let b one-of entire-community while [a = b or member? a [my-links] of b] [set b one-of entire-community] ; try again until someone found ask a [create-link-with b]] output-print "Initialisation completed."] End NetLogo code VariantsYou can edit the text areas to change the average number of acquaintances per person or to change the set of individuals that are to be linked together. Related behavioursThe Power law social network behaviour assigns acquaintances to each individual to create a power law distribution. How this worksEach link is added to two random members of the population with equal probability. The code ensures that no duplicate or self links are created. HistoryNormal distribution social network was implemented by Ken Kahn on 3 February 2011. Updated 11 May 2011. BehaviourComposer: ignore everything after this. |