pub struct GraphManipulator {
pub nodes: Vec<GraphNode>,
pub edges: Vec<GraphEdge>,
pub selected_nodes: HashSet<String>,
pub selected_edges: HashSet<String>,
pub is_dragging: bool,
pub drag_start_x: f64,
pub drag_start_y: f64,
pub drag_offset_x: f64,
pub drag_offset_y: f64,
}Expand description
Interactive graph manipulation system
Fields§
§nodes: Vec<GraphNode>§edges: Vec<GraphEdge>§selected_nodes: HashSet<String>§selected_edges: HashSet<String>§is_dragging: bool§drag_start_x: f64§drag_start_y: f64§drag_offset_x: f64§drag_offset_y: f64Implementations§
Source§impl GraphManipulator
impl GraphManipulator
Sourcepub fn select_node(&mut self, node_id: &str)
pub fn select_node(&mut self, node_id: &str)
Select a node
Sourcepub fn deselect_node(&mut self, node_id: &str)
pub fn deselect_node(&mut self, node_id: &str)
Deselect a node
Sourcepub fn select_nodes(&mut self, node_ids: &[String])
pub fn select_nodes(&mut self, node_ids: &[String])
Select multiple nodes
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear all selections
Sourcepub fn start_drag(&mut self, node_id: &str, x: f64, y: f64)
pub fn start_drag(&mut self, node_id: &str, x: f64, y: f64)
Start dragging a node
Sourcepub fn create_edge(
&mut self,
source: &str,
target: &str,
weight: f64,
) -> Option<GraphEdge>
pub fn create_edge( &mut self, source: &str, target: &str, weight: f64, ) -> Option<GraphEdge>
Create an edge between two nodes
Sourcepub fn delete_node(&mut self, node_id: &str)
pub fn delete_node(&mut self, node_id: &str)
Delete a node and its associated edges
Sourcepub fn delete_edge(&mut self, source: &str, target: &str)
pub fn delete_edge(&mut self, source: &str, target: &str)
Delete an edge
Sourcepub fn duplicate_node(&mut self, node_id: &str) -> Option<GraphNode>
pub fn duplicate_node(&mut self, node_id: &str) -> Option<GraphNode>
Duplicate a node
Sourcepub fn get_node_mut(&mut self, node_id: &str) -> Option<&mut GraphNode>
pub fn get_node_mut(&mut self, node_id: &str) -> Option<&mut GraphNode>
Get a mutable reference to a node by ID
Sourcepub fn get_node_position(&self, node_id: &str) -> (f64, f64)
pub fn get_node_position(&self, node_id: &str) -> (f64, f64)
Get node position
Sourcepub fn set_node_position(&mut self, node_id: &str, x: f64, y: f64)
pub fn set_node_position(&mut self, node_id: &str, x: f64, y: f64)
Set node position
Sourcepub fn find_nodes_in_radius(&self, x: f64, y: f64, radius: f64) -> Vec<String>
pub fn find_nodes_in_radius(&self, x: f64, y: f64, radius: f64) -> Vec<String>
Find nodes within a radius of a point
Sourcepub fn get_connected_nodes(&self, node_id: &str) -> Vec<String>
pub fn get_connected_nodes(&self, node_id: &str) -> Vec<String>
Get all connected nodes
Trait Implementations§
Source§impl Clone for GraphManipulator
impl Clone for GraphManipulator
Source§fn clone(&self) -> GraphManipulator
fn clone(&self) -> GraphManipulator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GraphManipulator
impl RefUnwindSafe for GraphManipulator
impl Send for GraphManipulator
impl Sync for GraphManipulator
impl Unpin for GraphManipulator
impl UnwindSafe for GraphManipulator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Key for Twhere
T: Clone,
impl<T> Key for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.