pub struct Graph { /* private fields */ }
Expand description
A GraphViz graph structure with RAII-based memory management.
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn new_with_strictness(
name: &str,
directed: bool,
strict: bool,
) -> Result<Self, GraphvizError>
pub fn new_with_strictness( name: &str, directed: bool, strict: bool, ) -> Result<Self, GraphvizError>
Creates a new GraphViz graph with the specified name, direction, and strictness.
Strict graphs do not allow multiple edges between the same pair of nodes.
§Arguments
name
- The name of the graphdirected
- Whether the graph is directed or undirectedstrict
- Whether the graph is strict (no duplicate edges)
§Returns
A Result containing the new Graph or an error
Sourcepub fn builder(name: &str) -> GraphBuilder
pub fn builder(name: &str) -> GraphBuilder
Sourcepub fn create_node(&self, name: &str) -> NodeBuilder<'_>
pub fn create_node(&self, name: &str) -> NodeBuilder<'_>
Sourcepub fn add_edge(
&self,
from: &Node<'_>,
to: &Node<'_>,
name: Option<&str>,
) -> Result<Edge<'_>, GraphvizError>
pub fn add_edge( &self, from: &Node<'_>, to: &Node<'_>, name: Option<&str>, ) -> Result<Edge<'_>, GraphvizError>
Sourcepub fn create_edge<'a>(
&'a self,
from: &'a Node<'_>,
to: &'a Node<'_>,
name: Option<&str>,
) -> EdgeBuilder<'a>
pub fn create_edge<'a>( &'a self, from: &'a Node<'_>, to: &'a Node<'_>, name: Option<&str>, ) -> EdgeBuilder<'a>
Sourcepub fn node_count(&self) -> i32
pub fn node_count(&self) -> i32
Sourcepub fn edge_count(&self) -> i32
pub fn edge_count(&self) -> i32
Sourcepub fn set_attribute(
&self,
name: &str,
value: &str,
) -> Result<(), GraphvizError>
pub fn set_attribute( &self, name: &str, value: &str, ) -> Result<(), GraphvizError>
Sourcepub fn get_attribute(&self, name: &str) -> Result<Option<String>, GraphvizError>
pub fn get_attribute(&self, name: &str) -> Result<Option<String>, GraphvizError>
Sourcepub fn remove_node(&self, node: Node<'_>) -> Result<(), GraphvizError>
pub fn remove_node(&self, node: Node<'_>) -> Result<(), GraphvizError>
Sourcepub fn remove_edge(&self, edge: Edge<'_>) -> Result<(), GraphvizError>
pub fn remove_edge(&self, edge: Edge<'_>) -> Result<(), GraphvizError>
Sourcepub fn name(&self) -> Result<String, GraphvizError>
pub fn name(&self) -> Result<String, GraphvizError>
Sourcepub fn is_directed(&self) -> bool
pub fn is_directed(&self) -> bool
Trait Implementations§
Source§impl AttributeContainer for Graph
impl AttributeContainer for Graph
Source§fn set_attribute(&self, name: &str, value: &str) -> Result<(), GraphvizError>
fn set_attribute(&self, name: &str, value: &str) -> Result<(), GraphvizError>
Sets an attribute on the container. Read more
Source§fn get_attribute(&self, name: &str) -> Result<Option<String>, GraphvizError>
fn get_attribute(&self, name: &str) -> Result<Option<String>, GraphvizError>
Gets an attribute value from the container. Read more
Source§fn has_attribute(&self, name: &str) -> Result<bool, GraphvizError>
fn has_attribute(&self, name: &str) -> Result<bool, GraphvizError>
Checks if an attribute exists on the container. Read more
Source§fn set_attribute_if_absent(
&self,
name: &str,
value: &str,
) -> Result<(), GraphvizError>
fn set_attribute_if_absent( &self, name: &str, value: &str, ) -> Result<(), GraphvizError>
Sets an attribute if it doesn’t already exist. Read more
Source§fn remove_attribute(&self, name: &str) -> Result<(), GraphvizError>
fn remove_attribute(&self, name: &str) -> Result<(), GraphvizError>
Removes an attribute if it exists. Read more
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl !Send for Graph
impl !Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more