Gato: Documentation

For Developers

We have quite a lot of comments in the source and HTML-documentation generated with HappyDoc. See our internal documentation.

Visualisation How-To

Concept: All visualisation in Gato happens automatically based upon edges or vertices of the graph changing their status with respect to data structures used in an algorithm.

Files: Algorithms are supplied in two files: The prolog (*.pro) and the actual algorithm implementation visible to the user (*.alg). The prolog contains declaration which allow for 'nicer' code in the algorithm, subroutines specific to the algorithm which should not be visible to the user, variables, and a proper setup of the animation engine.

Before running: Making sure we have the right graph If you have a statement like self.NeededProperties({propName1:value1, propName2:value2,...]}) Gato will check that the graph the user selected has the specified values for all the properties in the dictionary. Note, this is currently not supported by Gato's file format.

Setting breakpoints: With

  self.SetBreakpoints([7,9,2])
you can switch on breakpoints at educationally sensible points of the algorithm.

Using Animated Data Structures: Typical data structures like stacks and queues etc. have animated counter parts. If you say

  Q = AnimatedVertexQueue()
putting a vertex v on the queue
  Q.Append(v)
will color it in the color cColorOnQueue (defined in GatoGlobals.py) and removing it with the command
  v = Q.Top()
will color it in the color cRemovedFromQueue. So an ordinary breadth-first-search will give you a reasonable visualisation just by replacing the Queue by an AnimatedVertexQueue.

Interacting with the user: You can the user allow to select a vertex or an edge by calling

  v = self.PickVertex()
  e = self.PickEdge()
These functions take an optional argument for a callback function.