The two things you need to set in the script dot.cgi are the path to your copy of the Graphviz program dot,and a directory where dot can write temporary files (I use /tmp).
You can get a copy of the script here.
To render an image of a graph on the fly you insert an img
tag with the src attribute comprising:
- the path to the CGI script, e.g. /cgi-bin/dot.cgi
- a '/' delimiter
- the URL of the graph file, e.g. http://localhost/~rpage/dot/leda.7.46.gml.dot
- the extension of the image format you want (e.g., png, svg, etc.) preceeded by a dot "."
As an example, here is the dot file http://localhost/~rpage/dot/leda.dot as a PNG image, using the HTML:
<img src="/cgi-bin/dot.cgi/http://localhost/~rpage/dot/leda.dot.png" />
The source file for this graph looks like this:
graph G {
node [width=.2,height=.2,fontsize=10];
edge [fontsize=10,len=2];
0 [label="0"];
1 [label="3"];
2 [label="4"];
3 [label="5"];
4 [label="6"];
5 [label="7"];
0 -- 1 [label="13"];
0 -- 2 [label="12"];
0 -- 5 [label="8"];
0 -- 4 [label="71"];
1 -- 5 [label="84"];
1 -- 4 [label="8"];
2 -- 5 [label="18"];
2 -- 4 [label="11"];
2 -- 3 [label="51"];
3 -- 4 [label="87"];
}