pub struct GraphLayout {
pub positions: Vec<(u64, NodePosition)>,
}Expand description
A mapping of node IDs to 2-D canvas positions.
Fields§
§positions: Vec<(u64, NodePosition)>(node_id, position) pairs.
Implementations§
Source§impl GraphLayout
impl GraphLayout
Sourcepub fn get_position(&self, node_id: u64) -> Option<&NodePosition>
pub fn get_position(&self, node_id: u64) -> Option<&NodePosition>
Returns the position of node_id, or None if not yet placed.
Sourcepub fn set_position(&mut self, node_id: u64, pos: NodePosition)
pub fn set_position(&mut self, node_id: u64, pos: NodePosition)
Sets or updates the position for node_id.
Sourcepub fn auto_layout_left_right(nodes: &[u64], edges: &[(u64, u64)]) -> Self
pub fn auto_layout_left_right(nodes: &[u64], edges: &[(u64, u64)]) -> Self
Computes a column-based left-to-right layout using BFS layering.
nodes is the ordered list of all node IDs; edges is a list of
(from_id, to_id) pairs. Nodes in the same BFS depth layer are
stacked vertically, spaced 100 units apart. Layers are spaced 200
units horizontally.
Trait Implementations§
Source§impl Debug for GraphLayout
impl Debug for GraphLayout
Source§impl Default for GraphLayout
impl Default for GraphLayout
Source§fn default() -> GraphLayout
fn default() -> GraphLayout
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GraphLayout
impl RefUnwindSafe for GraphLayout
impl Send for GraphLayout
impl Sync for GraphLayout
impl Unpin for GraphLayout
impl UnsafeUnpin for GraphLayout
impl UnwindSafe for GraphLayout
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> 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 more