Git Product home page Git Product logo

network-portrait-divergence's Introduction

Network Portrait Divergence

Python code for computing network portrait divergences, a simple, general-purpose tool for comparing networks.

Networks and their portraits

Please see the paper for more details:

An information-theoretic, all-scales approach to comparing networks
James P. Bagrow and Erik M. Bollt, Applied Network Science, 4 (1): 45 (2019)
arXiv:1804.03665

Table of Contents

Usage

The output of each calculation is a float between 0 and 1 describing how similar the two networks are (0 = identical, 1 = maximally different, according to this measure).

Network portrait divergences can be computed at the command line or within Python scripts:

Command line

  1. Basic example:
    python portrait_divergence.py data/net1.edgelist data/net2.edgelist

  2. Networks stored in GraphML files:
    python portrait_divergence.py -graphml digraph_time1.graphml digraph_time2.graphml

  3. Use faster C++ code (assuming it's installed):
    python portrait_divergence.py --cpp big_g.edgelist big_h.edgelist

  4. Let's get crazy:
    python portrait_divergence.py --weighted=strength -b 10 --graphml g.graphml h.graphml

The code supports directed and weighted networks.

See the help string for more: python portrait_divergence.py -h

Python

Here's a script to compare Erdős-Rényi and Barabási-Albert graphs:

import networkx as nx
from portrait_divergence import portrait_divergence

Ger1  = nx.erdos_renyi_graph(100, 3/99)
Ger2  = nx.erdos_renyi_graph(100, 3/99)
Gba1 = nx.barabasi_albert_graph(100, 3)
Gba2 = nx.barabasi_albert_graph(100, 3)

print("Djs(ER1,ER2) =", portrait_divergence(Ger1, Ger2))
print("Djs(ER1,BA1) =", portrait_divergence(Ger1, Gba1))
print("Djs(ER1,BA2) =", portrait_divergence(Ger1, Gba2))
print("Djs(BA1,BA2) =", portrait_divergence(Gba1, Gba2))

Result:

Djs(ER1,ER2) = 0.139438811433
Djs(ER1,BA1) = 0.831004770397
Djs(ER1,BA2) = 0.864124658944
Djs(BA1,BA2) = 0.214176902159

Requirements

A recent install of Anaconda Python should come with everything you need.

Citation

If you use Network Portrait Divergence, please cite our paper:

James P. Bagrow and Erik M. Bollt, An information-theoretic, all-scales approach to comparing networks, Applied Network Science, 4 (1): 45 (2019) arXiv:1804.03665

Here is a bibtex entry:

@article{bagrow2019information,
	Author = {Bagrow, James P. and Bollt, Erik M.},
	Doi = {10.1007/s41109-019-0156-x},
	Journal = {Applied Network Science},
	Number = {1},
	Pages = {45},
	Title = {An information-theoretic, all-scales approach to comparing networks},
	Doi = {10.1007/s41109-019-0156-x},
	eprint = {1804.03665},
	Volume = {4},
	Year = {2019},
}

See also:

Portraits of Complex Networks — the original paper on Network Portraits, one of the ideas behind Network Portrait Divergence.

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.