use vizoxide::{Graph, Context};
use vizoxide::layout::{apply_layout, Engine};
use vizoxide::render::{render_to_file, Format};
use vizoxide::attr::AttributeContainer;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let context = Context::new()?;
let mut graph = Graph::new("modify_attribute", true)?;
graph.set_attribute("bgcolor", "red")?;
graph.remove_attribute("bgcolor")?;
let bgcolor = graph.get_attribute("bgcolor")?;
println!("Graph 'bgcolor' after removal: {:?}", bgcolor);
let node = graph.add_node("NodeX")?;
node.set_attribute("style", "filled")?;
node.remove_attribute("style")?;
let style = node.get_attribute("style")?;
println!("Node 'style' after removal: {:?}", style);
apply_layout(&context, &mut graph, Engine::Dot)?;
render_to_file(&context, &graph, Format::Svg, "modify_attribute.svg")?;
Ok(())
}