A Graph consists of a set of vertices and edges.
Each edge connects two vertices (but if loops are allowed, then an edge can connect a vertex to itself).
In the Kevin Bacon game, each vertex is either the name of a Movie or of an actor.
In this case
- An edge connects a movie and an actor if the actor appeared in the movie
- there are no edges connecting a movie to a movie or connecting an actor to an actor
- In particular there are no loops.
A path in a graph from one vertex to another vertex is a sequence of edges connecting the vertices. The length of a path is the number of edges.
The Kevin Bacon Number of an actor is half the length of the shortest path in the Movie-Actor graph from the actor vertex to the Kevin Bacon vertex.