2. Definition of Algorithm Animation and its Functions




Algorithm animation is the process of abstracting a program's data, operations, and semantics, and creating dynamic graphical views of those abstractions [Stasko 1990]. Algorithm animation is designed to help users to understand an algorithm, evaluate existing program and debug a program.

A computer program contains data structures of the algorithm that it implements. During execution of the program, the values of the data structure change according to the implemented algorithm. Algorithm animation uses a graphical representation of the internal data structures of the algorithm implemented in the program and shows the changes of the data structures for each state to illustrate the execution and dynamic behaviour of that program. Through such representation, users can view the execution of the program step by step and are able to explore the underlying details of the algorithm and gain a better understanding of it.

For example, a program implements a LR parsing algorithm to parse an input string. The program contains three data structures, a parsing table, a stack and the input string. When the program executes, it obtains instructions by looking up entries in the parsing table and performs operations on the stack to parse the string. The instruction, input string symbol and elements on the stack in each state are changing all the time as the algorithm executes. It will be a difficult task for a student to capture the underlying changes if he/she is only presented with static text and picture. Algorithm animation, however, can show all information and current changes in a graphical view simultaneously. An example screen shot from a LR parsing animation produced by an algorithm animation system is shown in the following diagram:-

LR Parsing

Fig. 1 A screen shot of LR parsing animation

The diagram shows the progressing execution of the program implements LR parsing algorithm to parse the input string. In the diagram, the data structures are represented as graphical objects in the animation. When the animation executes, each step of parsing the input string including the current parsing input string symbol, current instruction in the parsing table, pushing elements in or popping elements off the stack are shown in action simultaneously.

Algorithm animation can also use to evaluate existing program by providing animated view of system components to help in monitoring system performance.

Besides helping users to understand an algorithm, algorithm animation can also be used to make debugging a program easier. To use algorithm animation in debugging a program, users annotate certain states in their programs to output animation commands, which are subsequently fed into the algorithm animation system to generate animation. Users can view how their program executes, the values for the data in each step and how each step affects subsequent steps in the program. This helps users to trace any errors, which may occur in their programs.



Back to top