← anamaya.fyi 2021 · college

Usually four films apart.

Two actors are connected if they appeared in a film together. Do that across 250 films and you get a graph — and the shortest route between any two people is a breadth-first search, the same one that solves a maze. The median pair here is about four hops apart, though roughly a quarter of pairs are not connected at all.

Pick two actors and see how they connect.

The graph

actors
films
co-star pairs
largest connected group

Why breadth-first

BFS visits everything one hop away, then everything two hops away, and so on — so the first time it reaches the target, it has arrived by the shortest route available. Depth-first would also find a path, but possibly a ridiculous one. When two actors return no path at all, they are in separate components of the graph: nobody in this dataset links them.

The dataset is 250 top-rated Indian films from 1955 to 2017, so it is a slice rather than the industry. An actor missing from it is missing from the graph, and a real-world connection through a film outside the list simply does not exist here.