This CGI program is based on basic concepts of Graph Theory, which is an area of Mathematics and Computer Science. In a graph, vertices or "nodes" are connected to one another in a way to model a particular problem. These connections are called edges and may have values associated with them.
In this problem, the nodes are NBA players. Edges represent NBA teams. If two players were on the same team in the same year, then an edge is created between the two nodes representing the players. By running different computer algorithms on the graph, we can compute interesting things about the graph. A relatively simple algorithm (breadth-first-search) finds the shortest path between two NBA players in our relatively simple graph.
To learn more about graph theory, select the link above or try this interactive introduction to graph theory.