Crates.io | graphviz-rs |
lib.rs | graphviz-rs |
version | 0.2.0 |
source | src |
created_at | 2023-03-10 09:10:35.770606 |
updated_at | 2023-10-11 05:51:13.891409 |
description | A parser for directed graph in dot format with FFI to Graphviz cgraph library |
homepage | |
repository | https://github.com/furiosa-ai/dot-graph |
max_upload_size | |
id | 806302 |
size | 74,643 |
dot parser in Rust implemented with FFI to Graphviz cgraph library.
dot-graph
parses a dot format file using C bindings to Graphviz (v7.0.6).
The system environment should be able to find and include the following header files.
#include <gvc.h>
#include <cgraph.h>
Coming from Linux,
$ sudo apt install graphviz-dev
And coming from vanilla Ubuntu, you may want to install these too.
$ sudo apt install build-essentials cmake
$ sudo apt install clang
Coming from Mac,
$ brew install graphviz
And coming from Apple Silicon Mac, and add an environment variable,
export CPATH=/opt/homebrew/include
Or, try building from the source code yourself following the guide.
use dot_graph::prelude::*;
fn main() -> Result<(), DotGraphError> {
/* parse from file */
let graph = parser::parse_from_file(/* path */)?;
let mut stdout = std::io::stdout();
graph.to_dot(&mut stdout)?;
/* parse from memory */
let graph = parser::parse_from_memory(/* dot file contents in memory */)?;
let mut stdout = std::io::stdout();
graph.to_dot(&mut stdout)?;
Ok(())
}