Layout
Layout is a rust library and a stand alone utility that draws graphs. Layout can parse Graphviz dot files and render them.
Library Usage
Add the following to Cargo.toml
:
= "0.1.2" # or
= { = "0.1.2", = ["log"] }
Load, parse and print the AST:
use gv;
let contents = "digraph { a -> b [label=\"foo\"]; }";
let mut parser = new;
match parser.process
The example above would print the program AST, or a readable error message, such as:
digraph {
node [fillcolor="purple"] A B;
node [fillcolor="orange"] Z;
node [fillcolor="green"] G; a = ;
^
Error: Expected an identifier.
Command Line Usage
Build the crate and render some dot files with the command
Gallery
This section presents a few graphs that were rendered from dot files:
A simple graph.
A simple graph with multiple shapes and labels.
A graph with a few style properties.
A large graph that demonstrates the edge crossing elimination optimization.
Unicode, emoji and right-to-left languages:
Support for Records (nested structures):
Debug-mode rendering that helps to visualize the layout decisions: