The HTML file is defined in template form in graph.html.template. There is actually not much template activity happening here at all. We're simply using the template capability so that we can rapidly substitute different graphs—all in JSON format—into the same HTML/JavaScript logic without much overhead.
After we've defined the usual HTML headings, we create a main() function in which we do all of our work. We start by extracting a possible filtering expression from the URL and making a regular expression from it. This means that the user can append a filter expression to the URL using the query string (?) operator, and we can act upon his wishes to restrict the list of nodes that we view. This is a particularly useful feature ...