Importing variables

I'm trying to control edge lengths in neato. Is it possible to import variables into a graph?
Ideally I would import a vector/array at the start eg "edges" and use it to describe the edge lengths . Something like:
import "edges"
n1 -- n2 [w=1 len=edges[1]].
Is this possible in the DOT language?

Sorry, no. Dot is a fairly

Sorry, no. Dot is a fairly low-level, declarative language. Typically, people handle the type of semantics you describe via pre-processing. One simple approach is to use the C-preprocessor.

#include "x.h"

digraph {
a -> b [len=LEN1]

where x.h contains

#define LEN1 10

Then cpp -I. x.gv | dot > out will give you what you want.

You can get fancier using gvpr filter.

Recent comments