def compute_spread(dg, influencers, threshold): curr_active_nodes = compute_k_diffusion(dg, K, influencers, threshold) active_nodes = set(influencers) for c in curr_active_nodes: active_nodes.add(c) num_active_nodes = len(active_nodes) return num_active_nodes
def compute_influence_spread(dg, seed_set, threshold): curr_active_nodes = set() influencers_set = set() for n in seed_set: influencers_set.add(n) curr_active_nodes.add(n) curr_active_nodes = compute_k_diffusion(dg, K, influencers_set, threshold) return curr_active_nodes