using the matchup data on the nba stats site, I created a graph with nodes being players and edges weighted by how much players guarded each other. I ran louvain community detection algorithm on it and it found 4 communities. this means there’s “naturally” 4 positions!

this isn’t a particularly surprising insight at all. it’s cool to see it borne out in the data though!

shoutout to divyahans for the idea.

in this second visualization, I took the matchup graph and ran node2vec on it. this embeds the nodes of the graph in high-dimensional space. presumably, players of the same position will be “close” to each other in this high dimensional space. I then used t-SNE to reduce the dimensionality so that it’s suitable for viewing.

please tweet / dm me @canzhiye any suggestions or questions!

disclaimer: I know the matchup data itself is not great and it’s not totally clear what constitutes a “matchup” between two players. A little discussion on that here.