Coder Social home page Coder Social logo

contagionmap's Introduction

contagionMap

Python library that allows the construction of contagion maps from network data.

This code accompanies the publication "Topological data analysis of truncated contagion maps" by Florian Klimm, Chaos 32, 073108 (2022) Link .

This code also allows the construction of non-truncated contagion maps as originally introduced in

Taylor, D., Klimm, F., Harrington, H. A., Kramár, M., Mischaikow, K., Porter, M. A., & Mucha, P. J. (2015). Topological data analysis of contagion maps for examining spreading processes on networks. Nature Communications, 6(1), 1-11.

embedding example figure

Prerequisites

  • Python (tested for 3.9.7)
  • Some standard Python libraries (numpy,networkx,...)

Optional

  • Ripser for the topological data analysis (persistent homology)
  • scanpy for the analysis of single-cell gene expression data

How-to

The code enables

  1. Construction of noisy geoemtric ring lattice networks
  2. Computation of (truncated) contagion maps
  3. Quantification of barcodes of these contagion maps with persistent homology

The simplest use case is

import cmap as conmap

# network construction
noisyRL = conmap.constructNoisyRingLattice(numberNodes=400,geometricDegree=6,nongeometricDegree=2)

# truncated contagion map
contagionMap_t03_truncated = conmap.runTruncatedContagionMap(noisyRL,threshold=0.3,numberSteps=20)

# compute ring stability with Ripser
ringStabilityTruncated = conmap.callRipser(contagionMap_t03_truncated)

# full contagion maps can be computed by setting the numberSteps parameter to infinity
contagionMap_t03_full= conmap.runTruncatedContagionMap(noisyRL,threshold=0.3,numberSteps=np.Inf)

# compute ring stability with Ripser
ringStabilityFull= conmap.callRipser(contagionMap_t03_full)

# for many noisy ring lattice networks the truncated contagion map yields a larger ring stability than the full contagion map. For details see the manuscript.

There is a small tutorial Jupyter Notebook in /python/tutorial.ipynb that compares a truncated with a full contagion map.

To reproduce the figures in the manuscript, see Jupyter notebooks in the folder /python.

contagionmap's People

Contributors

floklimm avatar

Stargazers

Mercury avatar Mu Bagriyanik avatar  avatar Jonas Braun avatar

Watchers

David Stalane 🐧 avatar  avatar

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.