pub struct Sccs<C: AsRef<[usize]> = Box<[usize]>> { /* private fields */ }Expand description
Strongly connected components.
An instance of this structure stores the index of the
component of each node. Components are numbered from 0 to
num_components.
Moreover, this structure makes it possible to sort the components by size, possibly using parallel methods.
Implementations§
Source§impl<C: AsRef<[usize]>> Sccs<C>
impl<C: AsRef<[usize]>> Sccs<C>
pub fn new(num_components: usize, components: C) -> Self
Sourcepub fn num_components(&self) -> usize
pub fn num_components(&self) -> usize
Returns the number of strongly connected components.
Sourcepub fn components(&self) -> &[usize]
pub fn components(&self) -> &[usize]
Returns a slice containing, for each node, the index of the component it belongs to.
Sourcepub fn compute_sizes(&self) -> Box<[usize]>
pub fn compute_sizes(&self) -> Box<[usize]>
Returns the sizes of all components.
Source§impl<C: AsMut<[usize]> + AsRef<[usize]>> Sccs<C>
impl<C: AsMut<[usize]> + AsRef<[usize]>> Sccs<C>
Sourcepub fn sort_by_size(&mut self) -> Box<[usize]>
pub fn sort_by_size(&mut self) -> Box<[usize]>
Renumbers the components by decreasing size.
After a call to this method, the sizes of strongly connected components will decreasing in the component index. The method returns the sizes of the components after the renumbering.
Sourcepub fn par_sort_by_size(&mut self) -> Box<[usize]>
pub fn par_sort_by_size(&mut self) -> Box<[usize]>
Renumbers the components by decreasing size using parallel methods.
After a call to this method, the sizes of strongly connected components will decreasing in the component index. The method returns the sizes of the components after the renumbering.
Trait Implementations§
Source§impl<C> AlignHash for Sccs<C>
impl<C> AlignHash for Sccs<C>
Source§fn align_hash(hasher: &mut impl Hasher, offset_of: &mut usize)
fn align_hash(hasher: &mut impl Hasher, offset_of: &mut usize)
hasher assuming to be positioned
at offset_of.Source§fn align_hash_val(&self, hasher: &mut impl Hasher, offset_of: &mut usize)
fn align_hash_val(&self, hasher: &mut impl Hasher, offset_of: &mut usize)
AlignHash::align_hash on a value.Source§impl<C> DeserInner for Sccs<C>where
usize: DeserInner,
C: DeserInner + AsRef<[usize]>,
for<'__epserde_desertype> DeserType<'__epserde_desertype, C>: AsRef<[usize]>,
impl<C> DeserInner for Sccs<C>where
usize: DeserInner,
C: DeserInner + AsRef<[usize]>,
for<'__epserde_desertype> DeserType<'__epserde_desertype, C>: AsRef<[usize]>,
Source§type DeserType<'__epserde_desertype> = Sccs<<C as DeserInner>::DeserType<'__epserde_desertype>>
type DeserType<'__epserde_desertype> = Sccs<<C as DeserInner>::DeserType<'__epserde_desertype>>
DeserType.Source§unsafe fn _deser_full_inner(
backend: &mut impl ReadWithPos,
) -> Result<Self, Error>
unsafe fn _deser_full_inner( backend: &mut impl ReadWithPos, ) -> Result<Self, Error>
Source§unsafe fn _deser_eps_inner<'deser_eps_inner_lifetime>(
backend: &mut SliceWithPos<'deser_eps_inner_lifetime>,
) -> Result<Self::DeserType<'deser_eps_inner_lifetime>, Error>
unsafe fn _deser_eps_inner<'deser_eps_inner_lifetime>( backend: &mut SliceWithPos<'deser_eps_inner_lifetime>, ) -> Result<Self::DeserType<'deser_eps_inner_lifetime>, Error>
Source§impl<C> SerInner for Sccs<C>
impl<C> SerInner for Sccs<C>
Source§const IS_ZERO_COPY: bool
const IS_ZERO_COPY: bool
ZeroCopy type has this constant set to false
serialization will panic.Source§type SerType = Sccs<<C as SerInner>::SerType>
type SerType = Sccs<<C as SerInner>::SerType>
Self, but
in some cases, as for references to slices,
it is customized.Source§unsafe fn _ser_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>
unsafe fn _ser_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>
Source§impl<C> TypeHash for Sccs<C>
impl<C> TypeHash for Sccs<C>
Source§fn type_hash_val(&self, hasher: &mut impl Hasher)
fn type_hash_val(&self, hasher: &mut impl Hasher)
TypeHash::type_hash on a value.impl<C: Copy + AsRef<[usize]>> Copy for Sccs<C>
Auto Trait Implementations§
impl<C> Freeze for Sccs<C>where
C: Freeze,
impl<C> RefUnwindSafe for Sccs<C>where
C: RefUnwindSafe,
impl<C> Send for Sccs<C>where
C: Send,
impl<C> Sync for Sccs<C>where
C: Sync,
impl<C> Unpin for Sccs<C>where
C: Unpin,
impl<C> UnwindSafe for Sccs<C>where
C: 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
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