Independent Cascades with Community Embeddedness and Permeability

The Independent Cascades with Community Embeddedness and Permeability model was introduced by Milli and Rossetti in 2020 [1].

This model is a combination of ICE and ICP methods.

The ICEP model starts with an initial set of active nodes A0; the diffusive process unfolds in discrete steps according to the following randomized rule:

  • When node v becomes active in step t, it is given a single chance to activate each currently inactive neighbor u. If v and u belong to the same community, the method acts as the ICE model, otherwise as the ICP model.
  • If u has multiple newly activated neighbors, their attempts are sequenced in an arbitrary order.
  • If v succeeds, then u will become active in step t + 1; but whether or not v succeeds, it cannot make any further attempts to activate u in subsequent rounds.
  • The process runs until no more activations are possible.


During the simulation a node can experience the following statuses:

Name Code
Susceptible 0
Infected 1
Removed 2


Name Type Value Type Default Mandatory Description
Edge threshold Edge float in [0, 1] 0.1 False Edge threshold
Community permeability Model float in [0, 1] 0.5 True Community Permeability

The initial infection status can be defined via:

  • fraction_infected: Model Parameter, float in [0, 1]
  • Infected: Status Parameter, set of nodes

The two options are mutually exclusive and the latter takes precedence over the former.


The following class methods are made available to configure, describe and execute the simulation:


class ndlib.models.epidemics.ICEPModel.ICEPModel(graph)

Edge Parameters to be specified via ModelConfig

Parameters:permeability – The degree of permeability of a community toward outgoing diffusion processes

Model Constructor

Parameters:graph – A networkx graph object
ICEPModel.set_initial_status(self, configuration)

Set the initial model configuration

Parameters:configuration – a `ndlib.models.ModelConfig.Configuration` object

Reset the simulation setting the actual status to the initial configuration.



Describes the current model parameters (nodes, edges, status)

Returns:a dictionary containing for each parameter class the values specified during model configuration

Specify the statuses allowed by the model and their numeric code

Returns:a dictionary (status->code)

Execute Simulation


Execute a single model iteration

Returns:Iteration_id, Incremental node status (dictionary node->status)
ICEPModel.iteration_bunch(self, bunch_size)

Execute a bunch of model iterations

  • bunch_size – the number of iterations to execute
  • node_status – if the incremental node status has to be returned.
  • progress_bar – whether to display a progress bar, default False

a list containing for each iteration a dictionary {“iteration”: iteration_id, “status”: dictionary_node_to_status}


In the code below is shown an example of instantiation and execution of an ICEP model simulation on a random graph: we set the initial set of infected nodes as 1% of the overall population, assign a threshold of 0.1 to all the edges and set the community permeability equal 0.3.

import networkx as nx
import ndlib.models.ModelConfig as mc
import ndlib.models.epidemics as ep

# Network topology
g = nx.erdos_renyi_graph(1000, 0.1)

# Model selection
model = ep.ICEPModel(g)

# Model Configuration
config = mc.Configuration()
config.add_model_parameter('fraction_infected', 0.1)
config.add_model_parameter('permeability', 0.3)

# Setting the edge parameters
threshold = 0.1
for e in g.edges():
    config.add_edge_configuration("threshold", e, threshold)


# Simulation execution
iterations = model.iteration_bunch(200)
  1. Milli and G. Rossetti. “Barriers or Accelerators? Modeling the two-foldnature of meso-scale network topologies indiffusive phenomena,” 2020