pub struct BTreeGraph(/* private fields */);
Expand description
A mutable RandomAccessGraph
implementation based on a vector of
BTreeSet
.
This implementation is slower and uses more resources than a VecGraph
,
but it is more flexible as arcs can be added in any order.
By setting the feature serde
, this struct can be serialized and
deserialized using serde.
§Implementation Notes
This is just a newtype for a LabeledBTreeGraph
with
()
labels. All
mutation methods are delegated.
Implementations§
Source§impl BTreeGraph
impl BTreeGraph
Sourcepub fn add_node(&mut self, node: usize) -> bool
pub fn add_node(&mut self, node: usize) -> bool
Add an isolated node to the graph and return true if it is a new node.
Sourcepub fn add_arc(&mut self, u: usize, v: usize) -> bool
pub fn add_arc(&mut self, u: usize, v: usize) -> bool
Add an arc to the graph and return whether it is a new one.
Sourcepub fn add_lender<I: IntoLender>(&mut self, iter_nodes: I) -> &mut Self
pub fn add_lender<I: IntoLender>(&mut self, iter_nodes: I) -> &mut Self
Add nodes and successors from an IntoLender
yielding a
NodeLabelsLender
.
Sourcepub fn from_lender<I: IntoLender>(iter_nodes: I) -> Self
pub fn from_lender<I: IntoLender>(iter_nodes: I) -> Self
Creates a new graph from an IntoLender
yielding a
NodeLabelsLender
.
Sourcepub fn add_arcs(&mut self, arcs: impl IntoIterator<Item = (usize, usize)>)
pub fn add_arcs(&mut self, arcs: impl IntoIterator<Item = (usize, usize)>)
Add arcs from an IntoIterator
, adding new nodes as needed.
The items must be pairs of the form (usize, usize)
specifying an arc.
Sourcepub fn from_arcs(arcs: impl IntoIterator<Item = (usize, usize)>) -> Self
pub fn from_arcs(arcs: impl IntoIterator<Item = (usize, usize)>) -> Self
Creates a new graph from an IntoIterator
.
The items must be pairs of the form (usize, usize)
specifying
an arc.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Trait Implementations§
Source§impl Clone for BTreeGraph
impl Clone for BTreeGraph
Source§fn clone(&self) -> BTreeGraph
fn clone(&self) -> BTreeGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BTreeGraph
impl Debug for BTreeGraph
Source§impl Default for BTreeGraph
impl Default for BTreeGraph
Source§fn default() -> BTreeGraph
fn default() -> BTreeGraph
Source§impl From<LabeledBTreeGraph> for BTreeGraph
impl From<LabeledBTreeGraph> for BTreeGraph
Source§fn from(g: LabeledBTreeGraph<()>) -> Self
fn from(g: LabeledBTreeGraph<()>) -> Self
Source§impl<'a> IntoLender for &'a BTreeGraph
impl<'a> IntoLender for &'a BTreeGraph
type Lender = <BTreeGraph as SequentialLabeling>::Lender<'a>
fn into_lender(self) -> Self::Lender
Source§impl PartialEq for BTreeGraph
impl PartialEq for BTreeGraph
Source§impl RandomAccessGraph for BTreeGraph
impl RandomAccessGraph for BTreeGraph
Source§impl RandomAccessLabeling for BTreeGraph
impl RandomAccessLabeling for BTreeGraph
Source§impl SequentialLabeling for BTreeGraph
impl SequentialLabeling for BTreeGraph
type Label = usize
Source§type Lender<'a> = IteratorImpl<'a, BTreeGraph>
where
Self: 'a
type Lender<'a> = IteratorImpl<'a, BTreeGraph> where Self: 'a
Source§fn num_arcs_hint(&self) -> Option<u64>
fn num_arcs_hint(&self) -> Option<u64>
Source§fn iter_from(&self, from: usize) -> Self::Lender<'_>
fn iter_from(&self, from: usize) -> Self::Lender<'_>
from
(included). Read moreSource§fn par_node_apply<A: Default + Send, F: Fn(Range<usize>) -> A + Sync, R: Fn(A, A) -> A + Sync>(
&self,
func: F,
fold: R,
granularity: Granularity,
thread_pool: &ThreadPool,
pl: &mut impl ConcurrentProgressLog,
) -> A
fn par_node_apply<A: Default + Send, F: Fn(Range<usize>) -> A + Sync, R: Fn(A, A) -> A + Sync>( &self, func: F, fold: R, granularity: Granularity, thread_pool: &ThreadPool, pl: &mut impl ConcurrentProgressLog, ) -> A
func
to each chunk of nodes of size node_granularity
in
parallel, and folds the results using fold
. Read moreSource§fn par_apply<F: Fn(Range<usize>) -> A + Sync, A: Default + Send, R: Fn(A, A) -> A + Sync, D: Succ<Input = usize, Output = usize>>(
&self,
func: F,
fold: R,
granularity: Granularity,
deg_cumul: &D,
thread_pool: &ThreadPool,
pl: &mut impl ConcurrentProgressLog,
) -> A
fn par_apply<F: Fn(Range<usize>) -> A + Sync, A: Default + Send, R: Fn(A, A) -> A + Sync, D: Succ<Input = usize, Output = usize>>( &self, func: F, fold: R, granularity: Granularity, deg_cumul: &D, thread_pool: &ThreadPool, pl: &mut impl ConcurrentProgressLog, ) -> A
func
to each chunk of nodes containing approximately
arc_granularity
arcs in parallel and folds the results using fold
. Read moreimpl Eq for BTreeGraph
impl SequentialGraph for BTreeGraph
impl StructuralPartialEq for BTreeGraph
Auto Trait Implementations§
impl Freeze for BTreeGraph
impl RefUnwindSafe for BTreeGraph
impl Send for BTreeGraph
impl Sync for BTreeGraph
impl Unpin for BTreeGraph
impl UnwindSafe for BTreeGraph
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
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
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>
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>
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