learngraphtheory.org

Guest

Sign in to keep your graphs and progress.

Algorithm Selection

Select an algorithm and generate steps to begin visualization

Influence Maximization with CELF

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

Time: O(k·n·R(V + E))
Space: O(R·E)
Use Case: Viral marketing, health campaigns, choosing influencers and sensors
Showing the example graph for this algorithm.
Algorithm Execution

Select an algorithm and generate steps to begin visualization

About Influence Maximization (CELF)

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.

How it works

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.

Applications

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.

Pseudocode

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 reaches

The 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.

Worked example, step by step

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.

  1. Single vertices. σ is estimated for all 10 vertices: A 3.85, B 3.62, F 3.43, C 3.4 and so on. These 10 evaluations are the only ones done for every vertex.
  2. Seed 1. A has the largest σ and becomes the first seed, σ = 3.85.
  3. Round 2. B tops the list, but its fresh gain is only 0.34: it reaches the same vertices as A. F drops to 2.99, C to 0.35. H, stored at 3.33, recomputes to 3.04. Then D, I, G and E are recomputed too, and H's 3.04 tops every stored bound: seed 2 is H, σ = 6.89.
  4. Round 3. F recomputes to 0.52, I to 0.7, G to 0.48 and J to 0.92. J's fresh 0.92 beats every stored bound, so B, C, D and E are never recomputed: seed 3 is J, σ = 7.81.
  5. Counting the work. 10 + 8 + 4 = 22 spread evaluations. Plain greedy would compute 10 + 9 + 8 = 27 and pick the same seeds.

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.

Complexity, and where it comes from

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.

When to use Influence Maximization (CELF), and when not to

Ways to choose seeds and what each one promises.

AlternativePrefer it whenCost
Top degree or PageRankA 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 greedyA 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 − ε

Common pitfalls

  • Too few random worlds. σ is an average, and with few worlds two close candidates can swap places by chance. This page uses 300 to stay fast. Papers use 10,000, or check that the seeds do not change when R grows.
  • Ranking by solo spread. B reaches 3.62 vertices on its own, the second best, yet adds only 0.34 once A is a seed. Taking the top k single vertices wastes seeds on the same audience. The greedy step always measures the gain over the current seeds.
  • Trusting made-up probabilities. The result depends on the probability of every link, which real data rarely gives. Estimate them from past cascades if possible, and check how much the seeds change when the probabilities change.

Frequently asked questions

What does submodular mean here?
Adding a vertex to a small seed set gains at least as much as adding it to a larger set that contains the small one. Intuitively, the more seeds there are, the more of the vertex's audience is already reached. This is what makes greedy close to optimal and CELF's shortcut correct.
Where does 1 − 1/e come from?
Nemhauser, Wolsey and Fisher proved in 1978 that greedy selection reaches at least 1 − 1/e of the best value for any monotone submodular function. Kempe, Kleinberg and Tardos showed that the spread is such a function, and Feige showed that no polynomial method can do better unless P = NP.
Are there other cascade models?
The linear threshold model gives every vertex a random threshold and activates it once the weight of its active neighbours passes it. Kempe, Kleinberg and Tardos showed that its spread is submodular too, so the same greedy method and CELF apply.

Related algorithms: Independent Cascade (Spread), PageRank, k-Core Decomposition, Betweenness Centrality, Katz Centrality

Built by Mohammed Islam HadjoudjWork with me

An example graph: you can change it, or start blank.

Zoom Controls

30%
Nodes: 10
Edges: 13