/Visualizing-Biased-Preferential-Attachment-Model-in-Networks

An implementation/simulation/visualization of the proposed Biased Preferential Attachment Model in Social Networks

Primary LanguagePython

Simulating a bipopulated minority-majority network augmented with homophily

Example Graph This repository is a simulation of the Biased Preferential Attachment Model as proposed in the paper Homophily and the Glass Ceiling Effect in Social Networks

Some theory

The Biased Preferential Attachment Model is an extension of the Preferential Attachment Model which consists of a bi-populated majority-minority network augmented with homophily.

  • Bi-populated: Two kinds of nodes exist in the network
  • Majority-Minority partition: The two kinds of nodes have a difference in numbers.
  • Homophily: Nodes with similar colour (or any quality in general) have higher tendency to connect.

Demo (apologies for the bad quality gif*, full quality video is available in the media folder) :

Animation Demo

Running your own simulation

  1. Install manim through the instructions in the docs. (A virtual environment is suggested.)
  2. Clone this repository and navigate into this folder through the terminal.
  3. Change the parameters for the simulation in the first few lines of main.py
    1. n - The number of nodes you want to simulate
    2. r - Probability of a each new node being red.
    3. rho - Probabilty of forming an edge with a node of different colour (rho = 1 represents no homophily, rho=0 represents full homophily)
  4. Run the following commands which will run the simlation and start the output video simulation.

For high quality video output(this will take time, but the output will not be pixelated):

manim -pqh main.py SimulateNetwork

For low quality, quick rendering of output (may lead to some pixelation):

manim -pql main.py SimulateNetwork
  1. The simmulation video will be saved in the media folder for further use.

* Pronounced as jif :P