Six degrees of Harry Potter – the first steps…

Posted on July 23, 2010



All researchers cannot resist the charms of J K Rowling’s Harry Potter; any academic book loan is no more than 6 degrees separated from a Harry Potter book loan.

On the surface, this may seem like a frivolous aim, but the fundamental techniques and APIs used will show patterns and possibilities that have a much wider, more useful and potentially less controversial outcomes.

Planned Steps:

1 – Get ISBNs for J K Rowling works:

Used the OpenLibrary API to get title, ISBN (10 and/or 13) for J K Rowling authored works:

2 – Load all these ISBNs into a set in Redis, and begin to find related items for all of these:

3 – Find related items of those related items found previously, and repeat once more. This gives up the ‘bottom up’ view of Harry Potter related items

4 – Given a reading list of ISBNs, check each one of those for related items, and recurse through two more levels until an the top-down search hits an ISBN already found in the bottom-up.


The code requires a Redis server to be running on the localhost at the normal port.


  • redis-py
  • simplejson
  • httplib2

Mendeley client (taken from requires (python) oauth2. To use the ‘’ wrapper, you need to add you consumer_key and consumer_secret to a file called ‘’


Checking the ISBNs for the Harry Potter books through the Talis Aspire Hackday API ( is a slightly depressing process – Only a single ‘hit’ found for one of the records… most of the other checking process looks like this:

Posted in: Uncategorized