The algorithm then finds the distances between any node found to be one edge away from the starting node to any node that is one additional edge away. The specific algorithm I used, Dijkstra’s algorithm, works by finding the distances between a starting node (NBA player) and all other nodes (NBA players) that can be connected with one edge (NBA team). For instance, the entry in the matrix representing a connection between Paul Pierce and Kevin Garnett would be a ‘1’ since they have played on the same team while the entry in the matrix representing a connection between Paul Pierce and Kobe Bryant would be a ‘0’ since they have never played on the same team.
An adjacency matrix is just a matrix that represents if two vertices of a graph, or in this case two players in the NBA, are connected. In order to use the algorithm, I first had to create an adjacency matrix. It’s the same sort of algorithm that Google Maps would use to determine the shortest route. In order to find the shortest link between two players I used a shortest-path algorithm. For my analysis, I decided to include all players from the entire 62 year of the NBA as well as any player that played on a BAA or ABA team as long as they were on a franchise that was eventually incorporated into the NBA. However, the only NBA version I could find includes players from only 1996-2001.
#6 degrees of separation kevin bacon full
In the interest of full disclosure, I am not the first one to apply this to sports or even basketball. Applying this same type of thinking into the world of sports, I sought to find shortest link, using teammates as connections, between every player in the history of the NBA. The number of people needed to connect to mathematician Paul Erdős, when co-authors are viewed as ‘connected’, is a mathematician’s Erdős number.
Treating two actors that were in the same film as ‘connected’, the game Six Degrees of Kevin Bacon seeks to connect actors to Kevin Bacon in six links or less.