pub struct Dag<T> { /* private fields */ }Expand description
DAG (Directed Acyclic Graph) for complex relationships
Implementations§
Source§impl<T: Clone + PartialEq> Dag<T>
impl<T: Clone + PartialEq> Dag<T>
Sourcepub fn add_node(&mut self, value: T) -> Result<PositionId, AdvancedCrdtError>
pub fn add_node(&mut self, value: T) -> Result<PositionId, AdvancedCrdtError>
Add a node
Sourcepub fn add_edge(
&mut self,
from: &PositionId,
to: &PositionId,
) -> Result<(), AdvancedCrdtError>
pub fn add_edge( &mut self, from: &PositionId, to: &PositionId, ) -> Result<(), AdvancedCrdtError>
Add an edge from source to target
Sourcepub fn remove_edge(
&mut self,
from: &PositionId,
to: &PositionId,
) -> Result<(), AdvancedCrdtError>
pub fn remove_edge( &mut self, from: &PositionId, to: &PositionId, ) -> Result<(), AdvancedCrdtError>
Remove an edge
Sourcepub fn delete_node(
&mut self,
node_id: &PositionId,
) -> Result<(), AdvancedCrdtError>
pub fn delete_node( &mut self, node_id: &PositionId, ) -> Result<(), AdvancedCrdtError>
Delete a node
Sourcepub fn topological_sort(&self) -> Vec<PositionId>
pub fn topological_sort(&self) -> Vec<PositionId>
Get topological sort of the DAG
Sourcepub fn get_nodes(&self) -> &HashMap<PositionId, DagNode<T>>
pub fn get_nodes(&self) -> &HashMap<PositionId, DagNode<T>>
Get all nodes (for debugging/inspection)
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Dag<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Dag<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T> StructuralPartialEq for Dag<T>
Auto Trait Implementations§
impl<T> Freeze for Dag<T>
impl<T> RefUnwindSafe for Dag<T>where
T: RefUnwindSafe,
impl<T> Send for Dag<T>where
T: Send,
impl<T> Sync for Dag<T>where
T: Sync,
impl<T> Unpin for Dag<T>where
T: Unpin,
impl<T> UnwindSafe for Dag<T>where
T: UnwindSafe,
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