BehaviourComposer: ignore everything before this.
Begin micro-behaviour Begin description: Create a social network with bi-directional links between all individuals where the number of acquaintances is distributed according to a power law.End description
Begin NetLogo code: substitute-text-area-for community-expression all-individuals substitute-text-area-for power-expression 1.6 substitute-text-area-for maximum-as-a-fraction .33 let entire-community community-expression let population count entire-community let number-of-links sort-by > power-law-list-no-zeros population power-expression round (population * maximum-as-a-fraction) 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 ## How this worksIt computes a power law distribution of links. First it computes the random distribution of number of links for each member of the population. It then creates links between the agents according to the distribution. This relies upon power-law-list which computes a random list of number of links with the desired distribution. If you need a particular average number of links per individual then you should experiment with the power parameter to power-law-list. For example in NetLogo run show mean power-law-list 10000 POWER round MAXIMUM-VALUE where POWER and MAXIMUM-VALUE are given different values. For example a power of 1.6 and maximum value of 33 yields very close to an average value of 4. ## HistoryPower law social network was revised to avoid zero connections by Ken Kahn on 3 March 2016. BehaviourComposer: ignore everything after this. |