EoN.percolate_network

EoN.percolate_network(G, p, *, rng=None)[source]

Performs percolation on a network G with each edge persisting with probability p

From figure 6.10 of Kiss, Miller, & Simon. Please cite the book if using this algorithm.

Performs bond percolation on the network G, keeping edges with probability p

Arguments:

G networkx Graph

The contact network

p number between 0 and 1

the probability of keeping edge

rng random number generator

If None, will be set to np.random.default_rng()

Returns:

H NetworkX Graph

A network with same nodes as G, but with each edge retained independently with probability p.

SAMPLE USE:

import networkx as nx
import EoN
import matplotlib.pyplot as plt
G = nx.fast_gnp_random_graph(1000,0.002)
H = EoN.percolate_network(G, 0.6)

#H is now a graph with about 60% of the edges of G