The Idea
Can you visualize a song by the connections between the words of its lyrics? I wanted to explore create and manipulating graph networks. What better way to do that than with an old fashioned Rick Roll.
The Data
I started with the raw "Never Gonna Give You Up" lyrics. I divided the song into lines to avoid creating connections where there logically weren't between the words. I used the Python NetworkX library to create my network. Each word in the song became a Node. Edges were drawn between neighboring words. These edges were updated with their frequency of appearance.
The Visualization
I started by creating a word cloud of the lyrics using the Python WordCloud library. I then created my graph network using the Python NetworkX and Javascript Vis.js libraries. I scaled the nodes and their shadows based on the frequency of the word appearance. Node color was lightened with word frequency to give a sense of depth. Edges were drawn with arrows to show the direction words appeared together. Edges were then darkened with their frequency of appearance.
The Results
First and foremost the project was fun. This graph helped illustrate the way lyrics of songs are often constructed. It is interesting to see the center showing mostly the chorus while the graph naturally created branches for the verses. Also, it proved a great learning opportunity to explore networks and the many ways we can visualize variables.