The Vocabulary

This defines a Graph as consisting of a number of Nodes..

Inputs are those nodes that precede a node, Outputs are nodes that follow a node

Assembling the text for Graphviz

This rule sheet will process all the graphs (you can have more than one in your input and they can share nodes) and it will generate the Graphviz expressions for all the nodes and connections in your graph. Action E does most of the work. It will automatically iterate over all the graphs and all the nodes within each graph and all of the outputs for every node. That's part of the power of Corticon! No need to code explicit loops! Note in particular the use of the alias node to ensure that only the nodes that belong to a particular graph are used in that graph.

Note: The various strings in the actions are NOT Corticon expressions; they are part of the graph definition language of Graphviz. So Essentially Corticon is coding a Graphviz program to draw your graph.

Test Case

Graph.text will look like this:

strict digraph U {size="10,10"; rankdir=LR;node [fontname = "Bitstream Vera Sans" fontsize = 8 shape = "circle" ];  edge [fontname = "Bitstream Vera Sans" fontsize = 8 ]; B->C;B->E;A->B;A->D;A->F;D->F;C->D;C->F;E->F;B[color=blue, shape=square];A[style=filled, fillcolor = red];D[fontsize=18.0];C[color=green, shape=triangle];}

Copy/Paste this into Graphviz to draw a diagram like this:

Graphviz is free software for drawing graphs

If you want to automate this so that Corticon actually draws the picture for you see here.

You can also add your own rules to this for determining the color and layout (see Graphviz manual for details)


Download rule model.