SWI-Prolog Graphviz layout library
Jan Wielemaker
SWI-Prolog Solutions b.v.
The Netherlands
E-mail: jan@swi-prolog.org
Abstract
This package provides library(graphviz), a binding to the layout part of the Graphviz libraries. It lays out a graph given in the DOT language and returns the positions of the nodes and the routes of the edges as a Prolog term. Nothing is rendered: the nodes and labels are drawn by the application, which tells Graphviz only their size. It is used by library(graphviz_layout) of XPCE.

Table of Contents

1 library(graphviz): Graphviz layout library
2 License

1 library(graphviz): Graphviz layout library

This library calls the layout functions of the graphviz libraries. It only uses the layout part of graphviz: there is no rendering and no text layout. It is intended for laying out graphs whose nodes and labels are drawn by the application, which tells graphviz only their size. See library(graphviz_layout) of xpce.

If possible, the binding is linked with the dot layout plugin. Other layout plugins are opened when an engine they provide is first used. Graphviz’ own plugin loading, which also loads its text layout and rendering plugins, is used only if no layout plugin was found when the library was built.

[nondet]graphviz_engine(?Engine)
True if the library can use the layout engine Engine. If Engine is unbound, enumerate the available engines. This opens all layout plugins that were found when the library was built. Otherwise plugins are only opened if those loaded so far do not provide Engine: asking for dot does not load the neato plugin and its dependencies.
[det]graphviz_layout_dot(+Engine, +Dot, -Layout, -Messages)
Lay out Dot, a graph in the DOT language as text, using the layout engine Engine, normally dot. Layout is a term
layout(bb(X0,Y0,X1,Y1), Nodes, Edges, Clusters)

in graphviz coordinates: points, with Y growing upwards.

Messages is a string holding the warnings of graphviz.

Errors
graphviz(Engine, What, Message) if the graph cannot be laid out. What is one of syntax or layout.

2 License

The Prolog and C sources of this package are licensed under the Simplified BSD license, as the rest of SWI-Prolog. Graphviz, which it links to, is licensed under the Eclipse Public License 1.0. Loading library(graphviz) registers this license, such that license/0 reports it.

Index

?
graphviz_engine/1
graphviz_layout_dot/4
license/0
2