# Facebook Friendships Make Visually Stunning Map

## An engineering intern at Facebook has rendered a visually stunning map of the geographic influences on friendships captured in Facebook's social graph.

Facebook’s social graph appears to those who look at it most as blocks of code. Paul Butler, an engineering intern at the company, has rendered it into a stunning visual map of friendships that proves his theory that geography and political borders influence where people live in relation to their friends.

To make the visual you see above, Butler started with a sample of ten million pairs of friends culled from the company’s Apache Hive data warehouse. Then he combined that information with each member’s geography and tallied the number of friends between each pairs of cities, merging that data with latitudes and longitudes of each location. He explored all of this in the open-source statistics environment called R.

Butler writes on the Facebook engineering blog:

To my relief, what I saw was roughly an outline of the world. Next I erased the dots and plotted lines between the points. After a few minutes of rendering, a big white blob appeared in the center of the map. Some of the outer edges of the blob vaguely resembled the continents, but it was clear that I had too much data to get interesting results just by drawing lines. I thought that making the lines semi-transparent would do the trick, but I quickly realized that my graphing environment couldn’t handle enough shades of color for it to work the way I wanted.

Instead I found a way to simulate the effect I wanted. I defined weights for each pair of cities as a function of the Euclidean distance between them and the number of friends between them. Then I plotted lines between the pairs by weight, so that pairs of cities with the most friendships between them were drawn on top of the others. I used a color ramp from black to blue to white, with each line’s color depending on its weight. I also transformed some of the lines to wrap around the image, rather than spanning more than halfway around the world.

The map rfulleplica posted above pales in comparison to the full-sized high-resolution version you can see by clicking this link.