# Betweenness centrality applied to Amazon books graph

I made a visualization of Amazon related products. Every link in visualization means two products are often bought together.

Now I'm applying various graph analysis techniques and am fascinated by the results. The biggest problem though is translating scientific terms to human language (please pardon me if it sounds snobberish).

For example, I calculated indegree centrality of nodes, and I called it "What's popular here". After all the most connected node means it's most often bought with all other products in a given graph.

Currently I'm working on betweenness centrality, and it yields quite interesting results, often contradicting degree centrality. But how would you interpret these results? Most important products?

For example, books graph of The art of R programming has the following top 3 nodes:

Indegree Centrality:

1. The art of R programming - 18 outgoing edges
2. R Cookbook (O'Reilly Cookbooks) - 14 outgoing edges
3. Doing Bayesian Data Analysis: A Tutorial with R and BUGS - 10 outgoing edges

Betweenness Centrality:

1. The art of R programming - centrality value of 1210
2. What is a p-value anyway? - centrality value of 896
3. Visualize This - centrality value of 784

The graph itself looks like this:

-
Just out of curiosity, what is the scale of your data? Where did you get this data from? –  user721975 Mar 8 '12 at 17:21
It's Amazon API. The public site ( yasiv.com/amazon ) has two levels of depth from the central node (that results in 50-150 nodes). In private builds I increase depth level up to 5-6 to get 500-1000 nodes graph. Unfortunately Amazon has quota limiting and I can quickly run out of it if I make 5 levels graphing public. –  Anvaka Mar 8 '12 at 19:12
Which software have you used to visualize the graph? –  niko Jun 12 '12 at 7:38
@niko it's my own library: github.com/anvaka/VivaGraphJS –  Anvaka Jun 18 '12 at 20:21

The difference between in-degree centrality and closeness centrality - or really any other centrality measure - the answer is that you're identifying different things.

Currently I'm working on betweenness centrality, and it yields quite interesting results, often contradicting degree centrality. But how would you interpret these results? Most important product?

I wouldn't necessarily call it the most important product. To my mind, a better description might be "core" products - those that regardless of what you purchase, it's relatively easy to end up at those books. Looking at your figure, the three most popular nodes are all near the center of your graph. They define places where, as soon as you move outside your sub-field, you have a somewhat higher level book that defines several groups.

Take Visualize This, as its the clearest illustration of this. Even if people don't jointly buy books about Tufte's theories and infographics about trivia, Visualize This is a common foundational book not very far removed from either group.

The same is true with the p-value book. No one jointly buys an "Idiots Guide to a Natural Science" book, a "Popular Statistics" book and a "Biostatistics" book. But all three can and do end up buying What Is a p-value anyway? Its a core book, useful to three different groups of readers.

-
Thank you very much, EpiGrad! 'Core products' - makes sense, though sounds a bit technical to me. I'll wait for other people answers, and if nothing better comes up, I'll accept yours. –  Anvaka Mar 8 '12 at 19:23

I have spent a fair amount of time looking at social networks (e.g., networks of players in Facebook social games) which involved frequent calculation and comparison of these three measures of Centrality (degree centrality, betweenness centrality, and closeness centrality).

For what it's worth, here's my interpretation of these metrics based on having repeatedly calculated and compared them them for people who play Facebook games.

Degree Centrality: celebrities--nearly always the players sorted in decreasing order of degree centrality, were names i immediately recognized (which might also be because i spend too much time reading yahoo celebrity news and gossip).

to calculate D/C: this metric is just a raw count of the number of edges for a given node.

Closeness Centrality: the players with the highest C/C are for the most part a different group than the group with the highest D/C. In general, players with a high C/C spend a lot of time playing FB games--for the top 5% of players, C/C correlates quite strongly with total sessions or total minutes played.

to calculate C/C: (i) calculate pairwise minimum path length for all nodes in the network (using Dijkstra's algorithm); (ii) for Node A, calculate the mean path length to all other nodes in the network; (iii) Closeness Centrality is equal to one over mean path length divided by maximum path length. Values of C/C range from 0 to 1, with higher numbers indicating lower mean distance

Betweeness Centrality: Once again, i noticed very little correlation between the leaders in this metric and the top scorers in either D/C or C/C.

That doesn't surprise me though given how different is the intuition behind this metric. B/C captures two related concepts. The first is the notion of a "boundary spanner"--e..g, a person is likely to be influential if they bridge two otherwise distinctd, separate sub-networks. "Bottleneck" is the second concept--e.g., a person or company positioned at a distribution bottleneck wields power solely as a result of that position.

To calculate B/C: (i) repeat the first step in the Closeness Centrality calculation above; (ii) from the list of shortest paths calculated in the first step, count the number which includes Node A.

-
Thank you Doug. Do you have a recommendation how could I 'translate' these terms applied to products graph? –  Anvaka Mar 8 '12 at 19:15
Speaking of social networks visualization. I created Facebook visualization: yasiv.com/facebook –  Anvaka Jun 18 '12 at 20:22