Commit 5147eb4e authored by Emden R. Gansner's avatar Emden R. Gansner

Clarify the need to specify the layout algorithm in demo.c.

parent 32cd628a
......@@ -37,9 +37,12 @@ call the function {\tt gvParseArgs}:
This function takes the context value, plus an array of strings
using the same conventions as the parameters to {\tt main} function
in a C program. In particular, {\tt argc} should be the number of
values in {\tt argv}. If {\tt argv[0]} is the name of one of the
values in {\tt argv}. If the base part of {\tt argv[0]} ({\tt argv[0]} with the
directory portion removed) is the name of one of the
layout algorithms, this will be bound to the \gvc\ value and used
at layout time.
(This can always be overridden by supplying a {\tt "-K"} flag, or by
supplying a {\tt "layout"} attribute in the graph.)
The remaining {\tt argv} values, if any, are interpreted exactly like
the allowed command line flags for any \gviz\ program.
Thus, {\tt "-T"} can be used to set the output type, and {\tt "-o"}
\section{A sample program: {\tt simple.c}}
This following code illustrates an application which uses \gviz\ to
position a graph using the \dot\ layout and then write the output
position a graph using the \dot\ layout and then writes the output
using the {\tt plain} format.
An application can replace the call to {\tt gvRender} with its own
function for rendering the graph, using the layout information
......@@ -76,6 +76,14 @@ int main(int argc, char **argv)
This example provides a modification of the previous example. Again it
relies on the \gviz\ renderers, but now it creates the graph dynamically
rather than reading the graph from a file.
Note that either the graph or the {\tt argv[]} values have to specify which
layout algorithm is used, as explained in Section~\ref{sec:gvc}. Specifically,
the input graph must have the {\tt layout} attribute set, or the command line
arguments must contain a valid {\tt "-K"} flag.
If not, {\tt gvParseArgs} will look at the base name part of {\tt argv[0]} and
use that as the name of desired layout program. For this to work, the executable
program needs to be renamed as one of the \gviz\ layout programs (cf. Section~\ref{sec:intro}).
#include <gvc.h>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment