Skip to content

A library-agnostic project for calculating exactly and efficiently social balance, based on the Aref, Mason and Wilson paper (https://arxiv.org/abs/1611.09030)

License

Notifications You must be signed in to change notification settings

morpheusthewhite/social-balance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social balance

This project implements calculation of frustration index, which determines the distance of a signed graph from structural/social balance, using the programming model defined in A modelling and computational study of the frustration index in signed networks, a paper by Samin Aref, Andrew J. Mason, Mark C. Wilson.

As in the paper, Gurobi is used for solving the optimization problem.

This repository contains a simple main.py using the functions defined to solve the problem for sample graph. It is library agnostic, so any graph library can be used.

Prerequisites

To run/use this project you need to install the Gurobi Optimizer and its python bindings (the easiest way being python -m pip install -i https://pypi.gurobi.com gurobipy), which can also be done for conda environments (see Gurobi guide for details). You also need at least Python 3.9 to run this code.

Also numpy is needed.

Usage

To run the examples

$ python main.py

The best way of using this code in your project is just copying social-balance.py into your folder and importing it (if you do it then please star this repository, it will help other people finding it).

If you appreciated my work, then follow me on GitHub.

License

Distributed under the MIT License. See LICENSE for more information.

About

A library-agnostic project for calculating exactly and efficiently social balance, based on the Aref, Mason and Wilson paper (https://arxiv.org/abs/1611.09030)

Topics

Resources

License

Stars

Watchers

Forks

Languages