cosasi Documentation#

_images/grasshopper.png

Overview#

cosasi is a Python package for graph diffusion source localization, allowing users to:

  • perform and evaluate source inference using standard techniques from literature,

  • contribute innovative localization methods to a growing core library, and

  • benchmark new techniques against a battery of comparable schemes.

_images/carbon.png

Above: Carbon image of example code snippet; copy-and-paste-able version below.#

import networkx as nx
import cosasi

G = nx.fast_gnp_random_graph(100, 0.25)
contagion = cosasi.StaticNetworkContagion(
    G=G,
    model="si",
    infection_rate=0.01,
    number_infected=3,
)
contagion.forward(100)
I = contagion.get_infected_subgraph(step=15)
result = cosasi.source_inference.multiple_source.netsleuth(G=G, I=I)
result.evaluate(contagion.get_source())

Table of Contents#

Indices and tables#