dot_graph
A library for generating Graphviz DOT language files. The code is forked from dot-rust with new API for easier to use.
Usage
The very basic three parts of a DOT file and in this library is Graph,
Node and Edge. Graph is the entry point of the library. You could
generate an empty graph .dot file by simply use:
use ;
let graph = new;
let dot_string = graph.to_dot_string.unwrap;
assert_eq!;
In order to add some basic nodes and edges:
use ;
let mut graph = new;
graph.add_node;
graph.add_node;
graph.add_edge;
let dot_string = graph.to_dot_string.unwrap;
assert_eq!;
If you want add some more attributes, like style, arrow, color, you could call these methods in a chain, like:
use ;
let mut graph = new;
graph.add_node;
graph.add_node;
graph.add_edge;
assert_eq!;
After version 0.2.1, dot_graph support subgraph generation, for example:
For more examples, please check the tests.
The library is under active development, we'll include more dot attributes in the future.
Roadmap (TODO list)
- support for subgraph
Contributing
- All sorts of contributing are welcome. create issue and/or PR as you please.
- We belive that TDD(Test-Driven Development) approach is helpful not only in development, but also in communication with each other. So adding more tests might be a good way to report a bug or even suggest a new feature.
License
dot_graph is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.
Related Project
rudg: Rust UML Diagram Generator. A library for generating UML diagram from Rust source code.