Skip to main content

WorkingGraph

Struct WorkingGraph 

Source
pub struct WorkingGraph { /* private fields */ }

Implementations§

Source§

impl WorkingGraph

Source

pub fn new() -> Self

Source

pub fn with_capacity(nodes: usize, edges: usize) -> Self

Source

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.

Source

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.

Source

pub fn node(&self, key: StableNodeKey) -> Option<&Node>

Source

pub fn edge(&self, key: StableEdgeKey) -> Option<&Edge>

Source

pub fn node_key(&self, id: &str) -> Option<StableNodeKey>

Source

pub fn edge_endpoints( &self, key: StableEdgeKey, ) -> Option<EdgeEndpoints<StableNodeKey>>

Source

pub fn nodes(&self) -> impl Iterator<Item = (StableNodeKey, &Node)>

Source

pub fn edges(&self) -> impl Iterator<Item = (StableEdgeKey, &Edge)>

Source

pub fn outgoing_edges( &self, node: StableNodeKey, ) -> impl DoubleEndedIterator<Item = StableEdgeKey> + ExactSizeIterator + '_

Source

pub fn incoming_edges( &self, node: StableNodeKey, ) -> impl DoubleEndedIterator<Item = StableEdgeKey> + ExactSizeIterator + '_

Source

pub const fn node_count(&self) -> usize

Source

pub const fn edge_count(&self) -> usize

Source

pub const fn is_empty(&self) -> bool

Source§

impl WorkingGraph

Source

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

Source

pub fn remove_edge(&mut self, key: StableEdgeKey) -> Option<Edge>

Source

pub fn remove_node(&mut self, key: StableNodeKey) -> Option<Node>

Source

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.

Source

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

Source§

fn default() -> WorkingGraph

Returns the “default value” for a type. Read more
Source§

impl GraphView for WorkingGraph

Source§

type Node = StableNodeKey

Source§

type Edge = StableEdgeKey

Source§

fn node_count(&self) -> usize

Source§

fn edge_count(&self) -> usize

Source§

fn contains_node(&self, node: StableNodeKey) -> bool

Source§

fn contains_edge(&self, edge: StableEdgeKey) -> bool

Source§

fn node_indices(&self) -> impl Iterator<Item = Self::Node> + '_

Source§

fn edge_indices(&self) -> impl Iterator<Item = Self::Edge> + '_

Source§

fn edge_endpoints(&self, edge: Self::Edge) -> Option<EdgeEndpoints<Self::Node>>

Source§

fn outgoing_edges( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Edge> + '_

Source§

fn incoming_edges( &self, node: Self::Node, ) -> impl Iterator<Item = Self::Edge> + '_

Source§

fn edge_references( &self, ) -> impl Iterator<Item = (Self::Edge, EdgeEndpoints<Self::Node>)> + '_

Source§

impl IndexGraphView for WorkingGraph

Source§

fn node_bound(&self) -> usize

Source§

fn edge_bound(&self) -> usize

Source§

fn node_slot(node: Self::Node) -> usize

Source§

fn edge_slot(edge: Self::Edge) -> usize

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.