Crates.io | irox-dot |
lib.rs | irox-dot |
version | 0.1.0 |
source | src |
created_at | 2024-06-27 20:02:03.178815 |
updated_at | 2024-06-27 20:02:03.178815 |
description | DOT Graph Description Language writer, compatible with GraphViz |
homepage | https://github.com/spmadden/irox |
repository | https://github.com/spmadden/irox |
max_upload_size | |
id | 1286108 |
size | 12,965 |
DOT Graph Description Language writer, compatible with GraphViz
std
use irox_dot::*;
fn main() -> Result<(), irox_bits::Error> {
let mut graph = Graph::named("TestGraph");
graph.graph_type = GraphType::Digraph;
// add a top-level graph attribute
graph.add_graph_attr("landscape", "true");
// add a basic node with no attributes
graph.add_node(Node::new("Node 1"));
// add an edge
graph.add_edge(Edge::new(&graph, "Node 1", "Node 2"));
let mut out = String::with_capacity(256);
graph.write_to(&mut out)?;
println!("{out}");
Ok(())
}
produces:
digraph TestGraph {
landscape=true
"Node 1"
"Node 1" -> "Node 2"
}