Dissertation – Part 1

Its been a month since I have submitted my dissertation and as promised in the previous posts (http://goo.gl/XqYvuP and http://goo.gl/c7Lvu6 ) now it’s time to start blogging about the dissertation and its outputs. So starting from today I would try to do one post every day  for at least 2 weeks, talking about one aspect of my dissertation, leading up to the final results and conclusions.

To give brief introduction, In my dissertation (titled-“Network theory approach on modelling occurrence of Road Accidents – Case study UK”) I set out to create a dual graph of UK roads, attach the Road accidents data to the graph, find patterns in the distribution of accidents in the dual graph and find correlations between this distribution and the properties of the network.

Today, as a start I want to do a flash-forward into the whole process and share one of the key outputs produced as a part of the dissertation – A static visualisation of the dual graph of the entire road network of UK (England, Scotland and Wales) showing the betweenness centrality of each and every node.

Betweenness Centralities - Road Network, UK

Explanation: The above visualisation shows all the roads in UK as points (simplified by averaging the coordinates of their constituent segments)  and intersections between roads as lines connecting the corresponding points. The size of the points show the betweenness centrality of the corresponding roads in the information space. To put it simply, the visualisation highlights the most central roads in UK when the network is resolved as a dual graph. We can see that M25 is the most central road in the whole network with  a the highest probability of being in a shortest path derived between any two random roads in the network. The visualisation is produced using Processing.

Though it is simple plot of a series of data on a 2D plane, lot of things have been done in the background to create this abstract representation of the UK road network, about which I would be blogging in detail starting from tomorrow. I am hoping this series of posts are interesting to the readers and help me identify all the holes, drawbacks and errors in my research process.


Simple Random Network

Random Network

As I have started working on my dissertation full-flegedly, I have been reading a lot on networks and the properties of networks. This work is a part of the reading process where I built a simple random network generator in processing so that I can understand the the stuff I am reading better. The generator can be accessed here (http://balaspa.50webs.com/r_net/) and it is really fun to experiment with simple Erdos-Renyi’s random network. The instructions are included in the page.

Cellular Automata and Game of Life.

As a part of the digital visualisation module with the M.Res Programme, we were building cellular automata models with processing. The exercise was really interesting especially the Conway’s game of life where small amount of rules and coding generates a animation which is sometimes rich and endless. To be more specific the model is set in a plain canvas which is divided into equal grids and each cells is either alive/dead. There are three rules

  1. If the number of neighboring cells (n) of a cell is less than the loneliness limit then an alive cell dies
  2. If n is more than the overcrowding limit then an alive cell dies
  3. If n is equal to the creation condition then a dead cell becomes alive and rest stays the same.

I was experimenting with the same model and was trying to create something out of the game of life model by changing some of its rules. The results are as below,

1) Original Game of life:

Here the parameters are, loneliness limit = 2, Overcrowding limit = 3 and the creation condition = 3. This is by far the most interesting set of parameters which creates a life like situation where organic patterns emerge and spread and die. It even results in some mobile ‘organisms’ which can move along the canvas.

2) Space Filling Fractal:

Here the parameters are – Loneliness limit = 2, Overcrowding limit = 1 and the creation condition = 5. When the initial condition is a alive cell in the sides of the canvas (not the corners), the alive cell goes on to create a fractal growth which kind of fills up the space.

3) Sierpinski’s Gasket:

Here the parameters are – Loneliness limit = 2, Overcrowding limit = 2 and the creation condition = 1. When the initial condition is such that all the cells in the diagonals are alive, it goes on to create a Sierpinski’s gasket in the corners of the canvas.

4) Growth and Edges:

Here the parameters are varied through out the simulation and it shows how an object can be created by using a normal initial condition and using a combination of parameters (please note that the parameters are actually changing during the video) which are controlled manually. Even the edges of the object generated can be isolated by just changing parameters.

The code which resulted in the above videos can be downloaded here. The instructions are as below

  • press ‘r’ to reset the canvas to blank.
  • press ‘u’ to start or stop the simulation.
  • click and drag in the canvas to introduce alive cells.
  • press ‘a’ to introduce alive cells all  along the mid points, press ‘s’ to introduce alive cells along the diagonals and press ‘x’ to introduce both.
  • press ‘-‘ or ‘+’ to decrease or increase the overcrowding limit and press ‘[‘ or ‘]’ to decrease or increase the creation limit.

Have fun. p.s You need to have processing to run the above code. which can be downloaded here.

Accidents in United Kingdom over 2010 – Animation

Continuing from the last post, this is a visualization of essentially the same data but with a temporal element as well. The video below shows the occurrence of road accidents in UK during 2010 as it happened in time. Each frame in the video adds an hour of accidents to the canvas as bright blue dots and a second in the video is equivalent to 2 days in real time. The light blue shadow is left behind by previously occurred accidents building a cumulative map. As before, the animation is built with processing + blender and the data is cleaned with R and excel. To be honest there nothing much to observe and infer from the visualization at this level except for the small breathing effect which may be due to the peak hours and nights in traffic and how the accident locations correlates with heavily populated areas with dense roads. The video is embedded below and I would recommend increasing the HD setting to 720p for a good quality, comprehensible video.

The source for the data is from UK Data service at here.

Accidents in UK – Initial Visualization

As a part of the data collection for the dissertation, I just got my hands on a huge set of records detailing every accident happened in 2010 within UK and as the first step towards interpreting the data I tried to map of all the accidents recorded as points in their relative locations. After 2-3 hours of struggle with R [for data cleaning] and processing [for visualization , the final result is as below. The map below shows every accident recorded in UK in 2010 as a cyan dot mapped in the canvas relative to each other (approx. not to scale). Though there is already lot of work done in visualizing this data set [1] [2] [3] [4] [5] , I think this is a solid first step for me explore and build confidence in this area. This being a start I think i’ll be posting a lot of similar stuff here as the dissertation progresses.


The source for the data is from UK Data service at here. [note: Click the image for a larger version of the map]

A Simple Gravity Model

Another experiment with processing I did in the last 2 days. This time it is an interactive visualization of newton’s law of gravity applied over a bunch of objects. It is a simple demonstration of the gravity model showing the force between objects based on their mass and distance. Orange dots depict an object with mass equivalent to their area and the white line drawn between them shows the force between two objects. Though it is not a perfectly detailed model, the results are quite stunning visually when there is a large number of objects with distinct clusters. The instructions are as below,

  • Click the canvas to add an object.
  • Click a existing objectto select it
  • Click and drag an existing object to move it around the canvas
  • When selected, the size of an object can be increased or decreased by pressing ‘+’ and ‘-‘ key in the keyboard
  • Objects can be deselected by pressing ‘d’ key
  • The whole sketch can be reset with the ‘r’ key.

You can click the image to go to the interactive demo or follow the link here: http://balaspa.50webs.com/processing/gravity/

Barclay’s Bikes Data + Processing (Part II)

A more refined visualization of the same data used in the last post. As you can see this video is a demo of an interactive programme which can be downloaded here (32bit or 64bit).

To give a brief explanation, the visual canvas above shows an negative map (from OpenStreetMap) of central London with all the docks of Barclay’s cycle hire as orange dots. The name of the docks represented can be viewed by moving the mouse over the dots. One can view the number of trips made ‘from’ or ‘to’ a dock by selecting the dock by clicking the dot. Pressing the key ‘t’ in the keyboard toggles between the ‘start mode’ and the ‘end mode’. Two or more docks can be selected by dragging a box around them (just like Auto-CAD). Pressing the ‘r’ key deselects all the docks.

The major work here was getting the dock information from the trip data. I solved the problem by creating a array of dock class objects which is grown by serially reading the trip data and adding it to the array after checking if the specific dock is already in the list. The comparison is done through the location co-ordinates to remove any ambiguity caused due to names or ids. Apart from that building interactivity was quite tricky to understand in the beginning.

The video was done by recording a sketch frame by frame as .png images and stitching them up in blender (Thanks to Rex Harby).As usual, I request the readers to give it a try and share the results & problems in the comments section below. Also feel free to put in your suggestions and point out any mistakes.