Sunday, November 11, 2007

Websites as graphs: the key

A lot of bloggers seem to have discovered this little Applet recently; it draws a graph which shows a rough visual representation of the code structure of the site. Many of these graphs are very pretty, especially if you watch them as they draw, but what do they mean?

I first discovered this Applet in June 2006 and, at the time, there was a key to what was going on which I have reproduced below.
Everyday, we look at dozens of websites. The structure of these websites is defined in HTML, the lingua franca for publishing information on the web. Your browser's job is to render the HTML according to the specs (most of the time, at least). You can look at the code behind any website by selecting the "View source" tab somewhere in your browser's menu.

HTML consists of so-called tags, like the A tag for links, IMG tag for images and so on. Since tags are nested in other tags, they are arranged in a hierarchical manner, and that hierarchy can be represented as a graph. I've written a little app that visualizes such a graph, and here are some screenshots of websites that I often look at.

I've used some color to indicate the most used tags in the following way:
blue: for links (the A tag)
red: for tables (TABLE, TR and TD tags)
green: for the DIV tag
violet: for images (the IMG tag)
yellow: for forms (FORM, INPUT, TEXTAREA, SELECT and OPTION tags)
orange: for linebreaks and blockquotes (BR, P, and BLOCKQUOTE tags)
black: the HTML tag, the root node
gray: all other tags

So here are a few of my current sites (and it is interesting to compare them with those of 18 months ago). It is also interesting to compare how different Content Management Systems generate their code.

The Devil's Kitchen— (Blogger CMS).

Devil's Kitchen Design— (WebsiteBaker CMS).

Gronk— (WebsiteBaker CMS).

Finally, in order to get a flavour of another CMS (DruPal), here's Shane Greer's blog.

Rather fun!

1 comment:

Robert said...

May I direct you to a page on my site:

"I had a little nut-tree"...

Its 'graph', as generated by the visualiser, illustrates the nut-tree in the poem. I thought it was very clever, even if I do say so myself.