SubgraphWccs

Struct SubgraphWccs 

Source
pub struct SubgraphWccs<D: AsRef<[usize]> = Box<[usize]>, V: SliceByValue<Value = usize> = BitFieldVec<usize>> { /* private fields */ }
Expand description

A structure that gives access to connected components of a subgraph.

Implementations§

Source§

impl SubgraphWccs<Box<[usize]>, BitFieldVec<usize>>

Source

pub fn build_from_closure<G, I: IntoParallelIterator<Item = NodeId>>( graph: G, nodes: I, sort_by_size: bool, ) -> Result<Self>

Given a set of nodes, computes the connected components in the whole graph that contain these nodes.

For example, if a graph is:

A -> B -> C
     ^
    /
D --
E -> F -> G

then:

  • build_from_closure([A, D, F]) and build_from_closure([A, B, D, F]) compute [[A, B, C, D], [E, F, G]]
  • build_from_closure([A]) computes [[A, B, C, D]]
Source

pub fn build_from_nodes<G>( graph: G, nodes: Vec<NodeId>, sort_by_size: bool, ) -> Result<Self>

Given a set of nodes, computes the connected components in the subgraph made of only these nodes.

For example, if a graph is:

A -> B -> C
     ^
    /
D --
E -> F -> G

then:

  • build_from_nodes([A, D, F]) computes [[A], [D], [F]]
  • build_from_nodes([A, B, D, F]) compute [[A, B, D], [F]]
  • build_from_nodes([A]) computes [[A]]
Source

pub unsafe fn build_from_sorted_nodes<G>( graph: G, nodes: Vec<NodeId>, sort_by_size: bool, ) -> Result<Self>

Same as Self::build_from_nodes but assumes the vector of nodes is sorted.

§Safety

Undefined behavior if the vector is not sorted

Source

pub fn build_from_contraction<G>( graph: G, contraction: Contraction<EliasFano<SelectZeroAdaptConst<SelectAdaptConst<BitVec<Box<[usize]>>, Box<[usize]>, 12, 3>, Box<[usize]>, 12, 3>>>, sort_by_size: bool, ) -> Result<Self>

Same as Self::build_from_nodes but takes a Contraction as input instead of a Vec<usize>

Source§

impl<D: AsRef<[usize]>, V: SliceByValue<Value = usize>> SubgraphWccs<D, V>

Source

pub fn num_nodes(&self) -> usize

Returns the total number in all connected components

Source

pub fn contraction(&self) -> Contraction<&impl MonotoneContractionBackend>

Source

pub fn iter_nodes(&self) -> impl Iterator<Item = NodeId> + use<'_, D, V>

Returns an iterator on all the nodes in any connected component

Order is not guaranteed.

Updates the progress logger on every node id from 0 to self.num_nodes(), even those that are filtered out by an underlying subgraph.

Source

pub fn par_iter_nodes( &self, ) -> impl ParallelIterator<Item = NodeId> + use<'_, D, V>
where D: Sync + Send, V: Sync + Send,

Returns a parallel iterator on all the nodes in any connected component

Order is not guaranteed.

Updates the progress logger on every node id from 0 to self.num_nodes(), even those that are filtered out by an underlying subgraph.

Source

pub fn num_components(&self) -> usize

Returns the number of strongly connected components.

Source

pub fn component(&self, node: NodeId) -> Option<usize>

Given a node, returns which component it belongs to, if any

Source

pub fn component_size(&self, i: usize) -> Option<usize>

Returns None if component sizes were not computed, or the size of the ith component otherwise

Source

pub fn component_sizes( &self, ) -> Option<impl Iterator<Item = usize> + use<'_, D, V>>

Returns None if component sizes were not computed, Some(size) otherwise

Trait Implementations§

Source§

impl<D: AsRef<[usize]>, V> AlignHash for SubgraphWccs<D, V>
where usize: SerInner<SerType: AlignHash>, EliasFano<SelectZeroAdaptConst<SelectAdaptConst<BitVec<D>, D, 12, 3>, D, 12, 3>>: SerInner<SerType: AlignHash>, V: SerInner<SerType: AlignHash> + SliceByValue<Value = usize>, Option<EliasFano<SelectAdaptConst<BitVec<D>, D, 12, 3>>>: SerInner<SerType: AlignHash>,

Source§

fn align_hash(hasher: &mut impl Hasher, offset_of: &mut usize)

Accumulates alignment information in hasher assuming to be positioned at offset_of.
Source§

fn align_hash_val(&self, hasher: &mut impl Hasher, offset_of: &mut usize)

Calls AlignHash::align_hash on a value.
Source§

impl<D: AsRef<[usize]>, V: SliceByValue<Value = usize>> CopyType for SubgraphWccs<D, V>

Source§

impl<D: AsRef<[usize]>, V> DeserInner for SubgraphWccs<D, V>
where usize: DeserInner, EliasFano<SelectZeroAdaptConst<SelectAdaptConst<BitVec<D>, D, 12, 3>, D, 12, 3>>: DeserInner, V: DeserInner + SliceByValue<Value = usize>, Option<EliasFano<SelectAdaptConst<BitVec<D>, D, 12, 3>>>: DeserInner, for<'__epserde_desertype> DeserType<'__epserde_desertype, V>: SliceByValue<Value = usize>,

Source§

type DeserType<'__epserde_desertype> = SubgraphWccs<D, <V as DeserInner>::DeserType<'__epserde_desertype>>

The deserialization type associated with this type. It can be retrieved conveniently with the alias DeserType.
Source§

unsafe fn _deser_full_inner( backend: &mut impl ReadWithPos, ) -> Result<Self, Error>

Safety Read more
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>

Safety Read more
Source§

impl<D: AsRef<[usize]>, V> SerInner for SubgraphWccs<D, V>

Source§

const IS_ZERO_COPY: bool

Inner constant used by the derive macros to keep track recursively of whether the type satisfies the conditions for being zero-copy. It is checked at runtime against the trait implemented by the type, and if a ZeroCopy type has this constant set to false serialization will panic.
Source§

type SerType = SubgraphWccs<D, <V as SerInner>::SerType>

This is the type that will be written in the header of the file, and thus the type that will be deserialized. In most cases it is Self, but in some cases, as for references to slices, it is customized.
Source§

unsafe fn _ser_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

Serializes this structure using the given backend. Read more
Source§

impl<D: AsRef<[usize]>, V> TypeHash for SubgraphWccs<D, V>
where usize: SerInner<SerType: TypeHash>, EliasFano<SelectZeroAdaptConst<SelectAdaptConst<BitVec<D>, D, 12, 3>, D, 12, 3>>: SerInner<SerType: TypeHash>, V: SerInner<SerType: TypeHash> + SliceByValue<Value = usize>, Option<EliasFano<SelectAdaptConst<BitVec<D>, D, 12, 3>>>: SerInner<SerType: TypeHash>,

Source§

fn type_hash(hasher: &mut impl Hasher)

Accumulates type information in hasher.
Source§

fn type_hash_val(&self, hasher: &mut impl Hasher)

Calls TypeHash::type_hash on a value.

Auto Trait Implementations§

§

impl<D, V> Freeze for SubgraphWccs<D, V>
where V: Freeze, D: Freeze,

§

impl<D, V> RefUnwindSafe for SubgraphWccs<D, V>

§

impl<D, V> Send for SubgraphWccs<D, V>
where V: Send, D: Send,

§

impl<D, V> Sync for SubgraphWccs<D, V>
where V: Sync, D: Sync,

§

impl<D, V> Unpin for SubgraphWccs<D, V>
where V: Unpin, D: Unpin,

§

impl<D, V> UnwindSafe for SubgraphWccs<D, V>
where V: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CastableFrom<T> for T

Source§

fn cast_from(value: T) -> T

Call Self as W
Source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

Source§

fn cast(self) -> U

Call W::cast_from(self)
Source§

impl<T> DowncastableFrom<T> for T

Source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
Source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

Source§

fn downcast(self) -> U

Call W::downcast_from(self)
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

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

§

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Splat<T> for T

Source§

fn splat(value: T) -> T

Source§

impl<T> To<T> for T

Source§

fn to(self) -> T

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
Source§

impl<T> UpcastableFrom<T> for T

Source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
Source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

Source§

fn upcast(self) -> U

Call W::upcast_from(self)
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V