open-hypergraphs-dot 0.2.4

A library for visualizing lax open hypergraphs in GraphViz DOT format
Documentation
use crate::{generate_dot_with, Options};
use open_hypergraphs::lax::OpenHypergraph;

use graphviz_rust::{
    cmd::{CommandArg, Format},
    exec,
    printer::PrinterContext,
};

pub fn to_svg_with<O: PartialEq + Clone, A: PartialEq + Clone>(
    term: &OpenHypergraph<O, A>,
    opts: &Options<O, A>,
) -> Result<Vec<u8>, std::io::Error> {
    let dot_graph = generate_dot_with(term, opts);

    exec(
        dot_graph,
        &mut PrinterContext::default(),
        vec![CommandArg::Format(Format::Svg)],
    )
}