Git Product home page Git Product logo

structural-imbalance-demo's Introduction

https://circleci.com/gh/dwavesystems/structural-imbalance-demo.svg?style=svg

Demo of Structural Imbalance in Signed Social Networks

Social networks map relationships between people or organizations onto graphs, with the people/organizations as nodes and relationships as edges; for example, Facebook friends form a social network with friends represented as nodes with connecting edges. Signed social networks map both friendly and hostile relationships by setting the values of the edges between nodes with either plus ("+") or minus ("-") signs. Such networks are said to be structurally balanced when they can be clearly divided into two, with friendly relations (represented by positive-valued edges) in each faction, and hostile relations (negative-valued edges) between these factions.

The measure of structural imbalance or frustration for a signed social network is the minimum number of edges that violate this rule.

Three-person social network

Social theory suggests that increased frustration predicts social instability. In the context of militant organizations, this can result in increased violence.

This demo calculates and shows structural imbalance for social networks of militant organization based on data from the Stanford Militants Mapping Project:

Mapping Militant Organizations, Stanford University, last modified February 28, 2016, http://web.stanford.edu/group/mappingmilitants/cgi-bin/.

Setting Up the Demo

Copy (clone) this structural-imbalance-demo repository to your local machine.

In the root directory of your copy of this repository, execute one of the following two commands:

A. Install Dependencies for Local CPU Execution

pip install .[cpu]

B. Install Dependencies for D-Wave System Execution

pip install .[qpu]

Access to a D-Wave system must be configured, as described in the dwave-cloud-client documentation. A default solver is required.

Running the Demo

To run the demo, execture one of the following two commands:

A. Local CPU Execution

python demo.py cpu

B. D-Wave System Execution

python demo.py qpu

The demo fetches data from the Stanford Militants Mapping Project, calculates the networks, and saves PNG-formatted graphic files and CSV-formatted files in the root directory of your copy of the demo repository and in a Results subdirectory.

Note that this CLI command runs the entire demo and can take a few minutes to complete. You can easily modify the code to run just parts of the demo from within a Python interpreter.

License

See LICENSE file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.