Using python’s tkinter module we can create a logo style programs. To do this in python import the module tkinter. Draw the class turtle. Initialize the turtle class with coordinates and angle. Write a function draw_turtle. Draw three straight lines to form a triangle. Write another function delete_turtle to delete the lines. To move forward write mv_fwd function with a parameter ‘distance’. In this function first delete the turtle, draw a line to that distance and redraw the turtle. Preserve the angle.
To rotate write rt_lt and rt_rt functions. First delete the existing turtle. From the angle this function calculates the position of new turtle. Redraw it. rt_rt is just the negative angle of rt_lt.
Today the web applications have a great value. Anyone can access the application and do their jobs through the web. Hosting the application require a server, that manages the request and stores the data. Here the google appengine does the job. Google app engine is a cloud environment that provides the server-side services we want. Here the application is a graph colouring technique which takes a graph and provides a proper colour to each of the nodes according to the vertex colouring algorithm. This algorithm is implemented in python.
The front end of the project is a HTML5 page. It uses the web application languages javascript and jquery. Here the front-end consists of a html5 canvas and the control buttons. We can draw an undirected graph in the canvas using the control buttons. These buttons are created in html5 page. The program code resides in two files. One html5 file and one javascript file.
My graph colouring canvas
A html5 canvas is created using the canvas tag in html5 file. It contains the id and the size of the canvas. Using this id we can obtain the context of the canvas. Specifing this context it creates, the colour of the canvas, style etc. The html5 page displays the canvas and the buttons when it loads.
Visit my application at : http://colourthegraph.appspot.com/canvas/se11.html
Usually the term graph colouring algorithm indicates the vertex-colouring algorithm even though other algorithms are exists such as edge-colouring algorithm. The input of the graph colouring algorithm is the adjacentcy list of each node. It gives the nodes with the proper colour.
This Algorithm keeps a set of colours and the ‘availability list’ of colours for each node. First it takes each node in the order. It then checks the adjacentcy list of that node. If the first node in the list is coloured, it deletes that colour from the availability list. Then takes the next node from the adjacentcy list and the process continues. Last assigns the first colour in the availability list. This ensures the algorithm to take smallest number of colours.