pub struct WorkingGraph { /* private fields */ }Implementations§
Source§impl WorkingGraph
impl WorkingGraph
pub fn new() -> Self
pub fn with_capacity(nodes: usize, edges: usize) -> Self
Sourcepub fn insert_node(&mut self, node: Node) -> Result<StableNodeKey>
pub fn insert_node(&mut self, node: Node) -> Result<StableNodeKey>
Inserts a node idempotently and returns its generation-stable key.
§Errors
Returns an error for invalid nodes or conflicting definitions.
Sourcepub fn insert_edge(&mut self, edge: Edge) -> Result<StableEdgeKey>
pub fn insert_edge(&mut self, edge: Edge) -> Result<StableEdgeKey>
Inserts an edge after resolving its endpoint ids.
§Errors
Returns an error for invalid evidence or missing endpoints.
pub fn node(&self, key: StableNodeKey) -> Option<&Node>
pub fn edge(&self, key: StableEdgeKey) -> Option<&Edge>
pub fn node_key(&self, id: &str) -> Option<StableNodeKey>
pub fn edge_endpoints( &self, key: StableEdgeKey, ) -> Option<EdgeEndpoints<StableNodeKey>>
pub fn nodes(&self) -> impl Iterator<Item = (StableNodeKey, &Node)>
pub fn edges(&self) -> impl Iterator<Item = (StableEdgeKey, &Edge)>
pub fn outgoing_edges( &self, node: StableNodeKey, ) -> impl DoubleEndedIterator<Item = StableEdgeKey> + ExactSizeIterator + '_
pub fn incoming_edges( &self, node: StableNodeKey, ) -> impl DoubleEndedIterator<Item = StableEdgeKey> + ExactSizeIterator + '_
pub const fn node_count(&self) -> usize
pub const fn edge_count(&self) -> usize
pub const fn is_empty(&self) -> bool
Source§impl WorkingGraph
impl WorkingGraph
Sourcepub fn freeze(self) -> Result<FrozenGraph>
pub fn freeze(self) -> Result<FrozenGraph>
Canonicalizes the working graph and returns stable-to-compact remapping.
§Errors
Returns an error if an internal endpoint invariant is violated.
Source§impl WorkingGraph
impl WorkingGraph
pub fn remove_edge(&mut self, key: StableEdgeKey) -> Option<Edge>
pub fn remove_node(&mut self, key: StableNodeKey) -> Option<Node>
Sourcepub fn replace_node(
&mut self,
key: StableNodeKey,
node: Node,
) -> Result<Option<Node>>
pub fn replace_node( &mut self, key: StableNodeKey, node: Node, ) -> Result<Option<Node>>
Replaces a node while retaining its stable key.
§Errors
Returns an error for invalid data or a conflicting new identifier.
Sourcepub fn replace_edge(
&mut self,
key: StableEdgeKey,
edge: Edge,
) -> Result<Option<Edge>>
pub fn replace_edge( &mut self, key: StableEdgeKey, edge: Edge, ) -> Result<Option<Edge>>
Replaces an edge while retaining its stable key.
§Errors
Returns an error for invalid evidence or missing new endpoints.
Trait Implementations§
Source§impl Default for WorkingGraph
impl Default for WorkingGraph
Source§fn default() -> WorkingGraph
fn default() -> WorkingGraph
Returns the “default value” for a type. Read more
Source§impl GraphView for WorkingGraph
impl GraphView for WorkingGraph
type Node = StableNodeKey
type Edge = StableEdgeKey
fn node_count(&self) -> usize
fn edge_count(&self) -> usize
fn contains_node(&self, node: StableNodeKey) -> bool
fn contains_edge(&self, edge: StableEdgeKey) -> bool
fn node_indices(&self) -> impl Iterator<Item = Self::Node> + '_
fn edge_indices(&self) -> impl Iterator<Item = Self::Edge> + '_
fn edge_endpoints(&self, edge: Self::Edge) -> Option<EdgeEndpoints<Self::Node>>
fn outgoing_edges( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Edge> + '_
fn incoming_edges( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Edge> + '_
fn edge_references( &self, ) -> impl Iterator<Item = (Self::Edge, EdgeEndpoints<Self::Node>)> + '_
Auto Trait Implementations§
impl Freeze for WorkingGraph
impl RefUnwindSafe for WorkingGraph
impl Send for WorkingGraph
impl Sync for WorkingGraph
impl Unpin for WorkingGraph
impl UnsafeUnpin for WorkingGraph
impl UnwindSafe for WorkingGraph
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