:mage_woman: GraphWiz
GraphWiz provides builders to generate and render graphs in the GraphViz DOT //! format. It is adapted from its Haskell equivalent.
It's a "wizard" for Graphviz's DOT format, hence the name "GraphWiz".
Overview
This library is centered around a simple trait: Builder. Each Builder is
tied to a given "scope" of the graph: a RootBuilder is the scope of the
top-level graph definition, while a SubgraphBuilder represents the scope of
its associated subgraph or cluster. A builder provide functions to add new
entities within its scope: nodes, edges, subgraphs, and clusters.
Each entity is given a unique internal identifier, which avoid naming issues within the graph. Furthermore, edges are "smart" and do "auto-compound": if an edge starts from or goes to a cluster, the graph is labelled as "compound", and the attributes of the edge are adjusted so that they point properly to the cluster.
Example
The test file example.rs contains the following:
let mut root = new_builder;
root.defaults_mut.extend;
let a = root.new_node;
let b = root.new_node;
let ab = root.new_edge;
root.attributes_mut
.insert;
let mut cluster = root.new_cluster;
let c = cluster.new_node_with;
cluster.build;
root.new_edge;
root.new_edge;
let graph = root.build;
let text = render_digraph;
This generates the following DOT graph.
digraph
Which DOT renders like this: