pub struct Subgraph { /* private fields */ }Expand description
A self-contained subgraph composed of a subset of nodes and the edges that connect them internally.
Implementations§
Source§impl Subgraph
impl Subgraph
Sourcepub fn add_node(&mut self, node_idx: usize)
pub fn add_node(&mut self, node_idx: usize)
Add a node (by its parent-graph index) to the subgraph.
Sourcepub fn add_internal_edge(
&mut self,
from: usize,
to: usize,
) -> Result<(), String>
pub fn add_internal_edge( &mut self, from: usize, to: usize, ) -> Result<(), String>
Add an internal edge. Both endpoints must already be in the subgraph; returns an error string otherwise.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes in the subgraph.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Number of internal edges.
Sourcepub fn contains_node(&self, node_idx: usize) -> bool
pub fn contains_node(&self, node_idx: usize) -> bool
Returns true if node_idx is part of this subgraph.
Sourcepub fn internal_edges(&self) -> &[(usize, usize)]
pub fn internal_edges(&self) -> &[(usize, usize)]
Slice of all internal edges.
Sourcepub fn boundary(&self, all_edges: &[(usize, usize)]) -> SubgraphBoundary
pub fn boundary(&self, all_edges: &[(usize, usize)]) -> SubgraphBoundary
Compute the boundary of this subgraph given the full parent-graph edge
list all_edges.
An input boundary node is a node outside the subgraph that has an edge pointing into a subgraph node.
An output boundary node is a node inside the subgraph that has an edge pointing outside the subgraph.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Subgraph
impl RefUnwindSafe for Subgraph
impl Send for Subgraph
impl Sync for Subgraph
impl Unpin for Subgraph
impl UnsafeUnpin for Subgraph
impl UnwindSafe for Subgraph
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> 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