Re: [graphviz-interest] Hello list! Is there possibility to use "#include" directive in dot-files like in the c-files? It would be great to have a set of predefined nodes and attributes in "header" file and make only connections in "source" file of a graph. Also "typedef" keyword for definition of several similar subgraphs would be beneficial for definition of big graphs.
"Emden R. Gansner" <[email protected]> Mon, 7 Nov 2016 15:56:31 -0500
| Newsgroups | gmane.comp.video.graphviz |
|---|---|
| Message-ID | <[email protected]> |
> Hello list! Is there possibility to use "#include" directive in
> dot-files like in the c-files? It would be great to have a set of
> predefined nodes and attributes in "header" file and make only
> connections in "source" file of a graph. Also "typedef" keyword for
> definition of several similar subgraphs would be beneficial for
> definition of big graphs.
The actual commands don't do it automatically (but then neither does the
C compiler) but you can put any cpp directives in your source file, and
then pipe it through cpp and the layout engine. (See below.) There have
been discussions about higher-level syntax for frequently used
constructs, especially styles, but this was never implemented.
Frequently, you can get emulate this using subgraphs, cpp or gvpr. If
you are constructing big graphs, you are probably using a program
anyway, and such things can just be part of the program.
Emden
=====================
$ cpp pp.gv | dot
digraph G {
graph [bb="0,0,54,36",
bgcolor=lightgrey
];
node [label="\N"];
P1 [height=0.5,
pos="27,18",
width=0.75];
}
$ cat pp.gv
#define COLOR "lightgrey"
digraph G {
bgcolor=COLOR;
"P1" [ pos="360,288"];
}
$ cat pp.gv | cpp
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"
digraph G {
bgcolor="lightgrey";
"P1" [ pos="360,288"];
}
$ cat pp.gv | cpp | dot
digraph G {
graph [bb="0,0,54,36",
bgcolor=lightgrey
];
node [label="\N"];
P1 [height=0.5,
pos="27,18",
width=0.75];
}
$
_______________________________________________
[email protected]
http://lists.research.att.com/mailman/listinfo/graphviz-interest