This is a repository on the bounded confidence model of opinion dynamics, as first put forward by Hegselmann & Krause. This repository contains code for the model and for some visualizations.
To run the project, you first need to install the required packages
pip install -r requirements.txt
The class BoundedConfidence
in the module model.py
is an implementation of the bounded confidence model.
The method visualize
in the module visualize.py
can be used to visualize the run of a bounded confidence model.
The module produces all the images that are relevant to the paper.
This repository accompanies ongoing research. In the meantime, please cite as follows:
- Duijf, H. (2024). An implementation and visualization of the bounded confidence model. https://github.com/HeinDuijf/OpinionDynamicsHK
Released under the MIT licence.