The algorithm based on the optimization models (Aref and Neal "Detecting Coalitions by Optimally Partitioning Signed Networks of Political Collaboration" 2020 Scientific Reports) for computing the frustration index in relatively dense signed networks.
This algorithm is designed in Python 3.7 based on the models for computing the exact value of frustration index discussed in Aref and Neal (2020).
Linear programming (continuous) and binary linear (discrete) programming models for lower-bounding and computing the frustration index of relatively dense signed graphs - Jupyter code written by Samin Aref in 2018
Creative common license: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
Using this code for non-commercial purposes is permitted to all given that the three following publications are cited:
-
Aref, S, Mason, AJ, Wilson, MC. A modeling and computational study of the frustration index in signed networks. Networks. 2020; 75: 95– 110. url: https://doi.org/10.1002/net.21907
-
Aref, S., Mason, A. J., and Wilson, M. C., Computing the line index of balance using integer programming optimisation. In Optimization Problems in Graph Theory, B. Goldengorin, Ed. Springer, 2018, pp. 65-84. url: https://doi.org/10.1007/978-3-319-94830-0_3
-
Aref, S., and Neal, Z., Detecting Coalitions by Optimally Partitioning Signed Networks of Political Collaboration. Scientific Reports (2020). url: https://www.nature.com/articles/s41598-020-58471-z.
Related datasets:
Aref, S., Signed networks from sociology and political science, systems biology, international relations, finance, and computational chemistry. Figshare research data repository (2017). http://doi.org/10.6084/m9.figshare.5700832.v2.
Neal, Z., A Sign of the Times. Figshare research data repository (2019). http://doi.org/10.6084/m9.figshare.8096429.v1.
The following steps outline the process for installing the required software on your computer to be able to run the code:
1-Download and install Anaconda (Python 3.7 version) which allows you to run a Jupyter code. It can be downloaded from https://www.anaconda.com/distribution/. Note that you must select your operating system first and download the corresponding installer.
2-Register for an account on https://www.gurobi.com/registration-general-reg/ to get a free academic license for using Gurobi. Note that Gurobi is a commercial software, but it can be registered with a free academic license if the user is affiliated with a recognized degree-granting academic institution. This involves creating an account on Gurobi website to be able to request a free academic license in step 5.
3-Download and install Gurobi Optimizer (Latest version recommended) which can be downloaded from https://www.gurobi.com/downloads/gurobi-optimizer-eula/ after reading and agreeing to Gurobi's End User License Agreement.
4-Install Gurobi into Anaconda. You do this by first adding the Gurobi channel to your Anaconda channels and then installing the Gurobi package from this channel.
From a terminal window issue the following command to add the Gurobi channel to your default search list
conda config --add channels http://conda.anaconda.org/gurobi
Now issue the following command to install the Gurobi package
conda install gurobi
5-Request an academic license from https://www.gurobi.com/downloads/end-user-license-agreement-academic/ and install the license on your computer following the instructions given on Gurobi license page.
Completing these steps is explained in the following links (for version 9.0):
for windows https://www.gurobi.com/documentation/9.0/quickstart_windows/ins_the_anaconda_python_di.html
for Linux https://www.gurobi.com/documentation/9.0/quickstart_linux/ins_the_anaconda_python_di.html
for Mac OSX https://www.gurobi.com/documentation/9.0/quickstart_mac/ins_the_anaconda_python_di.html
After following the instructions above, open Jupyter Notebook which takes you to an environment (a new tab on your browser pops up on your screen) where you can open the main code (which is a file with .ipynb extension).