Let $SPEC
be
of type {(#actor:
string,
#interaction:
string,
#patient:
string)}
.
Build a module MkGif
that converts it into a directed
graph specification and invokes Graphviz to lay it out.
use cpl2perl;
$a = CPLIO->Open1 ("$SPEC");
open (DOT, "| ./dot -Tgif > $GIF");
print DOT "digraph aGraph {\n";
while (1) {
$rec = $a->LazyRead; last if ($rec eq "");
$start = $rec->Project ("actor");
$end = $rec->Project ("patient");
$type = $rec->Project ("interaction");
if ($type eq "inhibit") {
$edgecolor = "red"; }
else {
$edgecolor = "green"; }
$edge = "[color = $edgecolor]";
print DOT " $start-> $end $edge;\n"; }
print DOT "};\n";
$a->Close;
close (DOT);