EoN.percolate_network(G, p)[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

G networkx Graph
The contact network
p number between 0 and 1
the probability of keeping edge
H NetworkX Graph
A network with same nodes as G, but with each edge retained independently with probability p.
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