graphfind_rs/graph/
print.rs

1use crate::graph::Graph;
2
3/// The VizDotGraph trait allows a given Graph to be printed to the GraphViz format.
4pub trait VizDotGraph<NodeWeight, EdgeWeight>: Graph<NodeWeight, EdgeWeight> {
5    /// Prints the given graph. This function returns a String.
6    fn print(&self) -> String;
7
8    /// Displays the given graph as a picture (.svg file).
9    /// "path" file specifies the file path to save the picture into.
10    ///
11    /// The Result contains an error description, if something goes wrong.
12    ///
13    /// Requires the `svg` feature of this crate to be enabled.
14    #[cfg(feature = "svg")]
15    fn print_to_svg(&self, path: &str) -> Result<String, std::io::Error>;
16}