Guest
Sign in to keep your graphs and progress.
Select an algorithm and generate steps to begin visualization
Who should start the cascade?
Picks k seed vertices whose cascade reaches the most others: greedy, but it recomputes only the gains that could still win
Select an algorithm and generate steps to begin visualization
Influence maximization asks which k vertices to start with so that a cascade reaches as many vertices as possible. In the independent cascade model each newly reached vertex gets one chance to pass the cascade along each of its links, with the link's probability. Kempe, Kleinberg and Tardos showed in 2003 that finding the best seeds is NP-hard, but that the expected spread σ is monotone and submodular: a vertex adds less when the seed set is larger. So greedy selection, adding the vertex with the largest gain each round, is guaranteed to reach at least 1 − 1/e, about 63%, of the best possible spread.
Nobody can compute σ exactly on a large graph, so the visualizer samples 300 random worlds, in each of which every link is open with its probability, and averages how many vertices the seeds reach. The edge weights are the probabilities when they lie between 0 and 1, otherwise every link uses 0.3. Plain greedy recomputes every gain in every round. CELF, the lazy greedy method of Leskovec and colleagues from 2007, keeps the gains in a list and only recomputes the one at the top: because gains only shrink, a fresh gain that still tops every stored one must be the best. Each step shows the recomputed vertex, the seeds in red and, as badges, how often each vertex is reached. In the example, two clusters joined by a weak link, CELF picks A, H and J, reaching 7.81 of 10 vertices on average, with 22 spread evaluations instead of 27.
Influence maximization chooses the customers who get free samples in viral marketing, the people who carry a message in public health campaigns and the accounts that seed a social media launch. The same submodular structure places sensors in water networks to detect contamination early, which is the problem CELF was first built for, with speed-ups of several hundred times over plain greedy. Neo4j Graph Data Science provides CELF and greedy influence maximization. On very large graphs, methods based on reverse reachable sets estimate σ with far fewer simulations, and the result is only as good as the probabilities on the links.
Lazy greedy selection over a spread estimated by simulation.
CELF(G, k):
for each vertex v: gain(v) = sigma({v}) // all of them, once
S = {}
repeat k times:
loop:
v = the vertex with the largest stored gain
if gain(v) was computed for this S:
add v to S, stop the loop
gain(v) = sigma(S + v) - sigma(S) // recompute, put back
return S
sigma(S): average over R random worlds of the vertices S reachesThe shortcut works because σ is submodular: the gain of a vertex can only shrink as the seed set grows. A stored gain is therefore an upper bound on the vertex's current gain. When a freshly computed gain still beats every stored bound, no other vertex can beat it, and the remaining recomputations are skipped.
Two groups joined by a weak link, 10 vertices, k = 3 seeds, 300 random worlds.
Example graph: Group 1: A–B 0.6, A–C 0.6, A–D 0.5, A–E 0.5, B–C 0.5, B–D 0.4. Group 2: F–G 0.5, F–H 0.5, F–I 0.4, G–H 0.5, H–I 0.4, I–J 0.5. The bridge E–F has probability 0.1.
Seeds A, H and J reach on average 7.81 of the 10 vertices. The top three single vertices, A, B and F, would reach less, because A and B overlap.
Time: O(k·n·R(n + m)) for plain greedy · Space: O(n + m)
One estimate of σ runs R simulated cascades of O(n + m) each. Plain greedy needs k·n estimates. CELF has the same worst case but in practice recomputes only a handful of vertices per round, which Leskovec and colleagues measured as up to 700 times faster. Reverse reachable set methods such as IMM sample O((n + m)k log n / ε²) sets in total and keep the 1 − 1/e − ε guarantee.
Ways to choose seeds and what each one promises.
| Alternative | Prefer it when | Cost |
|---|---|---|
| Top degree or PageRank | A fast baseline. It ignores overlap, so it often picks seeds whose cascades cover the same vertices, as A and B here. | O(n + m), no guarantee |
| Plain greedy | A teaching version or tiny graphs. Same seeds and guarantee as CELF. | k·n spread estimates |
| Reverse reachable sets (TIM, IMM) | Networks with millions of edges. Samples random reverse cascades instead of simulating forward ones. | near-linear, 1 − 1/e − ε |
Read the full article: Graph Centrality Measures and PageRank
Read the full article: Applications of Graph Theory in the Real World
Related algorithms: Independent Cascade (Spread), PageRank, k-Core Decomposition, Betweenness Centrality, Katz Centrality
Built by Mohammed Islam Hadjoudj · Work with me