#attributes #graph #generate #language #defined #value #allowed

dotavious

A library for generating Graphviz DOT language files for graphs

3 unstable releases

0.2.1 Nov 6, 2021
0.2.0 Mar 25, 2021
0.1.0 Mar 23, 2021

#246 in Visualization

24 downloads per month

MIT license

155KB
3K SLoC

Dotavious

crates.io Released API docs MIT licensed CI

A library for generating Graphviz DOT language files for visualizing graphs.

Constraints / Limitations

  • Not every Attribute is fully documented/described. However, all those which have specific allowed values should be covered.
  • Deprecated Attributes are not defined.

Quickstart

use dotavious::{Dot, Edge, Graph, GraphBuilder, Node};
use std::io;
use std::io::Read;

// can also start building a named undirected graph via `GraphBuilder::new_named_undirected`
let graph = GraphBuilder::new_named_directed("example")
        .add_node(Node::new("N0"))
        .add_node(Node::new("N1"))
        .add_edge(Edge::new("N0", "N1"))
        .build()
        .unwrap();

let dot = Dot { graph };
println!("{}", dot);

which produces

digraph example {
    N0;
    N1;
    N0 -> N1;
}

and when rendered will look like

README example rendered

Dependencies

~1MB
~16K SLoC