Today is a fine day! I woke up to an email from pragprog.com – a publisher for programming and computer science textbooks – telling me that an updated version of “Complex Network Analysis in Python” by Dmitry Zinoviev has just been released and since I bought the ebook I can download the new version for free! Ok – that’s an update to a textbook, what’s the big deal you might ask… Let me explain:
This summer, I embarked on a journey exploring networks and their analysis. I had decided to work again with materials from the “Medieval German Religious Plays and VR/AR”-project I had developed in 2016, mainly trying to model the stage interactions of characters, but also places and objects in a way a machine can understand (and compute). This being a side project, I cannot invest much time and have to progress slowly. Interactions of characters sounded pretty networky to me, so I looked around for some basic introduction to networks and how to do something meaningful with them computationally. (Another side-project of mine is teaching myself coding with Python – and some other languages, so I didn’t want to stop at using a fancy digital humanities tool to do the network analysis for me, black-box style. but rather test my hypotheses using math done by a machine.) The Google search suggested a book called “Complex Network Analysis in Python”, which sounded very much spot on and looking at the release date January 2018 I had the impression that this was a good first investment: It does network stuff, with Python and is fairly new! What could go wrong?
I must say there’s rarely been textbooks that I liked reading, let alone enjoyed reading and most I put aside pretty quickly and forgot that they existed. However, with a background in humanities and their tendency to verboseness, obscurity, and rhetorics, what was I to expect? Much unlike the horrible textbooks I knew from studying, science textbooks, especially computer science textbooks are awesome! They explain just enough to get the main problems across, but never too much to drown the content in endless strings of letters. They have plenty of examples that you can follow along and execute with an immediate check whether you succeeded or not and most are written in a witty, almost colloquial style. CNA in Python definitely falls into that category. It was easy to read even though the subject matter is tough and the examples looked easy enough to follow along coding in a Jupyter Notebook. I installed all the necessary python packages for doing complex network analysis, especially networkX, using the command line (smirkingly)
pip install networkx
and thought I was good to go.
Not so fast! I had not payed attention to the fact that CNA in Python uses networkX v1. Since the release of the book, networkX had been migrated to v2, including major changes that rendered the examples in the book practically undoable, if the latest version of the networkX package is installed (which happens when you thing you’re smart using the pip command without checking first…). I realised that this wouldn’t work out. But I really liked the book and wanted to follow along teaching myself CNA and get better at programming with Python, too. So I googled a little more and found the documentation for networkX v2 as well as a migration guide explaining the changes from v1 to v2 and ‘translated’ the examples (of the first 5 chapters) into networkX v2 code to make it run in my notebook. I was successful (in almost all examples, some stuff still is beyond my abilities) and could make it work!
However, I stopped reading – and writing out the examples and translating them – after chapter 5 because of lack of time and other things needing my attention. Last week though, I taught a study group networkX for CNA using my examples, the examples from the book and Gephi, building on the material I had created for the Innsbruck Easterplay (blog posts here and here). It went really well, I advertised the book to my study buddies even but made it clear it is hard to use with the new version of networkX, but still worth a recommendation. A study group friend even told me to send the ‘translations’ to the author for the next version of CNA with Python, but I declined, hinting at that there are surely better suited people working on this than me.
And here they are! I’ve already downloaded the upgraded version and am more eager than ever to go through the examples again and see how the author (who is a proper computer scientist!) has done it in v2 and finally proceed with the book beyond chapter 5 where the real fun begins: the actual analysis of complex networks (with math!!). I will assign myself the remainder of the year 2018 to re-do chapters 1–5 and proceed further, applying what I have learned thus far to my example, the character, places and object network of the 1391 Innsbruck Easterplay. And I will offer a follow-up session for the study group on using the python package networkX, too!
If you want to buy to the book, you can do so here: https://pragprog.com/book/dzcnapy/complex-network-analysis-in-python . I am not payed or remunerated by pragprog.com or the author or anyone else to recommend this book, but do it because it is my honest opinion that this textbook is useful, has good examples and is fun to read! Also for non-computer scientists, programmers, and math people 🙂