Heuristic seed-set selection for Majority Cascade in social networks
Social influence is the ability of an individual (or a set of individuals) to change others’ behavior through the connections in a network. The Majority Cascade in Cost Networks problem asks to select a seed set
SMiLe-CoDe proposes a community-based and centrality-driven heuristic, compared experimentally against two other greedy and weighted approaches.
The project implements and compares four seed-selection strategies:
-
Cost‐Seeds‐Greedy (CSG) A submodular greedy approach that iteratively picks the node with the best
$\Delta\text{influence}/\text{cost}$ ratio, using incremental updates and a heap for efficiency. -
Weighted Target Set Selection (WTSS) A weighted threshold algorithm that processes nodes under three cases (zero threshold, impossible activation, priority by cost·threshold/degree²), extended to respect a budget constraint.
-
SMiLe-CoDe
- Partition the graph into communities
$C_1,\dots,C_m$ using Louvain - Allocate budget
$k_i = \lfloor k\cdot |C_i|/|V|\rfloor$ to each community - Perform a local greedy selection in each community based on betweenness centrality and cost
- Global phase to exhaust any remaining budget
- Partition the graph into communities
-
SMiLe-CoDe_bridges After the standard phases, picks remaining local bridges to extend influence to peripheral nodes, ordered by centrality priority.
All methods run a Majority Cascade simulation (threshold
Experiments on the ego-Facebook network (4,039 nodes, 88,234 edges; average clustering 0.6055) show:
- WTSS: near-complete coverage with moderate budgets (∼20 000 for Cost₁), but slower per-iteration time (~2.5 s).
- CSG: consistent performance across cost functions, fast iterations (~0.25 s), and smoother convergence.
- SMiLe-CoDe / bridges: steady growth, slightly below WTSS/CSG, with almost identical results between the base and bridges variants (selected local bridges tend to be isolated and of low impact).
Cost functions used:
-
Cost₁:
$\lceil\deg(v)/2\rceil$ -
Cost₂: random in
$[\min(\text{Cost}_1), \max(\text{Cost}_1)]$ - Cost₃: normalized betweenness centrality
- Python ≥ 3.10
- Git
- (recommended) virtualenv / venv
git clone https://github.com/Luigina2001/SMiLe-CoDe.git
cd SMiLe-CoDepython3 -m venv .venv
source .venv/bin/activatepip install --upgrade pip
pip install -r requirements.txtMake sure your dataset file is placed in data/ and named dataset.txt.
Example run:
# 1. Generate seed sets for each cost–algorithm combination
python algorithms/CSG.py
python algorithms/CSG_new.py
python algorithms/WTSS.py
python algorithms/SMiLe-CoDe.py
python algorithms/SMiLe-CoDe-bridges.py
# 2. Simulate Majority Cascade on the computed seeds
python algorithms/cascade.py \
--experiment_csv_path algorithms/logs/cost1_CSG.csv \
--graph_path data/dataset.txt \
--output_csv_path algorithms/logs/cascade/cost1_CSG_results.csv
# Repeat the simulation by varying cost{1,2,3} and algorithm in {CSG, CSG_new, WTSS, SMiLe-CoDe, SMiLe-CoDe-bridges}