Can xdot (language) be used as input to dot (program)?

Hi,

I need help figuring out whether xdot can be used as an input format for dot.

If I provide dot with an expression in the xdot language, i.e., provide extended attributes like _draw_ and _ldraw_, it seem that the dot program ignores these attributes.

For example, the _ldraw_ attribute is ignored in the following invocation:

echo 'digraph {
  a [_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 12.95 0 20.25 3 -xxx "]
}' | dot -Tpng

The attribute describes drawing a label with text “xxx”, but the resulting drawing will have a label of “a”.

So it looks like these attributes are “read-only”. I assume because the can be fully controlled by already existing attributes. Is this true? That there would be no need to allow you to write these attributes?

Background

I was exploring splitting the layout and rendering parts of drawing graphs using dot, I wanted to first obtain the output of the layout engine and then feed it back to the rendering engine, to better understand what was going on and to see where I could gain additional control over the output.

Curious to hear what people think.

I am 95% sure that you can’t use the xdot attributes to fully drive Graphviz output. (see below about the other 5%)
However, you can make many changes using the dot language, either stand-alone (no layout engine) or using pre- or post-processing. - see the FAQ (FAQ | Graphviz).

Here are some examples:

p.s. The 5% - it seems that you can make some changes to the Root graph via the draw attribute, but not to any other objects (maybe). Huh!

1 Like

Correct. Graphviz layout programs do not use the contents of _draw attributes as input.

1 Like

I should note that while my examples usually use gvpr (https://www.graphviz.org/pdf/gvpr.1.pdf) to create the desired effect, gvpr is not required.
One could accomplish the same results by manually editing a file, using almost any programming language to make changes as text, or by using any of the programming languages that interface with the Graphviz library (see https://www.graphviz.org/docs/library)

1 Like

Thanks all. That confirmed my suspicions.