pub struct Graph { /* private fields */ }Expand description
Opaque handle to an interactive graph.
Create with Graph::new(). The graph can be used programmatically
to build and inspect node/edge structures.
This type implements Drop to release the underlying SDK resource.
It is move-only (not cloneable).
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn remove_node(&mut self, node: NodeId) -> Status
pub fn remove_node(&mut self, node: NodeId) -> Status
Remove a node and all its incident edges.
Sourcepub fn total_node_count(&self) -> i32
pub fn total_node_count(&self) -> i32
Total number of nodes (including group/hidden nodes).
Sourcepub fn visible_node_count(&self) -> i32
pub fn visible_node_count(&self) -> i32
Number of visible (non-hidden) nodes.
Sourcepub fn node_exists(&self, node: NodeId) -> bool
pub fn node_exists(&self, node: NodeId) -> bool
Check if a node exists and is visible.
Sourcepub fn add_edge(&mut self, source: NodeId, target: NodeId) -> Status
pub fn add_edge(&mut self, source: NodeId, target: NodeId) -> Status
Add a directed edge from source to target.
Sourcepub fn add_edge_with_info(
&mut self,
source: NodeId,
target: NodeId,
info: EdgeInfo,
) -> Status
pub fn add_edge_with_info( &mut self, source: NodeId, target: NodeId, info: EdgeInfo, ) -> Status
Add a directed edge with visual properties.
Sourcepub fn remove_edge(&mut self, source: NodeId, target: NodeId) -> Status
pub fn remove_edge(&mut self, source: NodeId, target: NodeId) -> Status
Remove a directed edge.
Sourcepub fn replace_edge(
&mut self,
from: NodeId,
to: NodeId,
new_from: NodeId,
new_to: NodeId,
) -> Status
pub fn replace_edge( &mut self, from: NodeId, to: NodeId, new_from: NodeId, new_to: NodeId, ) -> Status
Replace edge (from, to) with (new_from, new_to).
Sourcepub fn successors(&self, node: NodeId) -> Result<Vec<NodeId>>
pub fn successors(&self, node: NodeId) -> Result<Vec<NodeId>>
Get successor node IDs for a node.
Sourcepub fn predecessors(&self, node: NodeId) -> Result<Vec<NodeId>>
pub fn predecessors(&self, node: NodeId) -> Result<Vec<NodeId>>
Get predecessor node IDs for a node.
Sourcepub fn visible_nodes(&self) -> Result<Vec<NodeId>>
pub fn visible_nodes(&self) -> Result<Vec<NodeId>>
Get all visible node IDs.
Sourcepub fn path_exists(&self, source: NodeId, target: NodeId) -> bool
pub fn path_exists(&self, source: NodeId, target: NodeId) -> bool
Check if a path exists from source to target.
Sourcepub fn create_group(&mut self, nodes: &[NodeId]) -> Result<NodeId>
pub fn create_group(&mut self, nodes: &[NodeId]) -> Result<NodeId>
Create a group containing the given nodes.
Sourcepub fn delete_group(&mut self, group: NodeId) -> Status
pub fn delete_group(&mut self, group: NodeId) -> Status
Delete a group node but keep its member nodes.
Sourcepub fn set_group_expanded(&mut self, group: NodeId, expanded: bool) -> Status
pub fn set_group_expanded(&mut self, group: NodeId, expanded: bool) -> Status
Expand (show contents) or collapse (hide contents) a group.
Sourcepub fn is_collapsed(&self, group: NodeId) -> bool
pub fn is_collapsed(&self, group: NodeId) -> bool
Check if a group node is collapsed.
Sourcepub fn group_members(&self, group: NodeId) -> Result<Vec<NodeId>>
pub fn group_members(&self, group: NodeId) -> Result<Vec<NodeId>>
Get the member nodes of a group.
Sourcepub fn set_layout(&mut self, layout: Layout) -> Status
pub fn set_layout(&mut self, layout: Layout) -> Status
Set the layout algorithm and recompute.
Sourcepub fn current_layout(&self) -> Layout
pub fn current_layout(&self) -> Layout
Return the currently selected layout algorithm.
Sourcepub fn redo_layout(&mut self) -> Status
pub fn redo_layout(&mut self) -> Status
Recompute the current layout.