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>>
impl SubgraphWccs<Box<[usize]>, BitFieldVec<usize>>
Sourcepub fn build_from_closure<G, I: IntoParallelIterator<Item = NodeId>>(
graph: G,
nodes: I,
sort_by_size: bool,
) -> Result<Self>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
pub fn build_from_closure<G, I: IntoParallelIterator<Item = NodeId>>(
graph: G,
nodes: I,
sort_by_size: bool,
) -> Result<Self>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
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 -> Gthen:
build_from_closure([A, D, F])andbuild_from_closure([A, B, D, F])compute[[A, B, C, D], [E, F, G]]build_from_closure([A])computes[[A, B, C, D]]
Sourcepub fn build_from_nodes<G>(
graph: G,
nodes: Vec<NodeId>,
sort_by_size: bool,
) -> Result<Self>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
pub fn build_from_nodes<G>(
graph: G,
nodes: Vec<NodeId>,
sort_by_size: bool,
) -> Result<Self>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
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 -> Gthen:
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]]
Sourcepub unsafe fn build_from_sorted_nodes<G>(
graph: G,
nodes: Vec<NodeId>,
sort_by_size: bool,
) -> Result<Self>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
pub unsafe fn build_from_sorted_nodes<G>(
graph: G,
nodes: Vec<NodeId>,
sort_by_size: bool,
) -> Result<Self>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
Same as Self::build_from_nodes but assumes the vector of nodes is sorted.
§Safety
Undefined behavior if the vector is not sorted
Sourcepub 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>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
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>where
G: SwhForwardGraph + SwhBackwardGraph + SwhGraphWithProperties + Sync + Send + 'static,
for<'succ> <<G as SwhForwardGraph>::Successors<'succ> as IntoIterator>::IntoIter: SortedIterator,
for<'pred> <<G as SwhBackwardGraph>::Predecessors<'pred> as IntoIterator>::IntoIter: SortedIterator,
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>
impl<D: AsRef<[usize]>, V: SliceByValue<Value = usize>> SubgraphWccs<D, V>
pub fn contraction(&self) -> Contraction<&impl MonotoneContractionBackend>
Sourcepub fn iter_nodes(&self) -> impl Iterator<Item = NodeId> + use<'_, D, V>
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.
Sourcepub fn par_iter_nodes(
&self,
) -> impl ParallelIterator<Item = NodeId> + use<'_, D, V>
pub fn par_iter_nodes( &self, ) -> impl ParallelIterator<Item = NodeId> + use<'_, D, V>
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.
Sourcepub fn num_components(&self) -> usize
pub fn num_components(&self) -> usize
Returns the number of strongly connected components.
Sourcepub fn component(&self, node: NodeId) -> Option<usize>
pub fn component(&self, node: NodeId) -> Option<usize>
Given a node, returns which component it belongs to, if any
Sourcepub fn component_size(&self, i: usize) -> Option<usize>
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
Sourcepub fn component_sizes(
&self,
) -> Option<impl Iterator<Item = usize> + use<'_, D, V>>
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>,
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)
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<D: AsRef<[usize]>, V: SliceByValue<Value = usize>> CopyType for SubgraphWccs<D, V>
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>,
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>>
type DeserType<'__epserde_desertype> = SubgraphWccs<D, <V 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<D: AsRef<[usize]>, V> SerInner for SubgraphWccs<D, V>where
usize: SerInner,
EliasFano<SelectZeroAdaptConst<SelectAdaptConst<BitVec<D>, D, 12, 3>, D, 12, 3>>: SerInner,
V: SerInner + SliceByValue<Value = usize>,
Option<EliasFano<SelectAdaptConst<BitVec<D>, D, 12, 3>>>: SerInner,
SerType<V>: SliceByValue<Value = usize>,
impl<D: AsRef<[usize]>, V> SerInner for SubgraphWccs<D, V>where
usize: SerInner,
EliasFano<SelectZeroAdaptConst<SelectAdaptConst<BitVec<D>, D, 12, 3>, D, 12, 3>>: SerInner,
V: SerInner + SliceByValue<Value = usize>,
Option<EliasFano<SelectAdaptConst<BitVec<D>, D, 12, 3>>>: SerInner,
SerType<V>: SliceByValue<Value = usize>,
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 = SubgraphWccs<D, <V as SerInner>::SerType>
type SerType = SubgraphWccs<D, <V 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<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>,
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_val(&self, hasher: &mut impl Hasher)
fn type_hash_val(&self, hasher: &mut impl Hasher)
TypeHash::type_hash on a value.Auto Trait Implementations§
impl<D, V> Freeze for SubgraphWccs<D, V>
impl<D, V> RefUnwindSafe for SubgraphWccs<D, V>where
V: RefUnwindSafe,
D: RefUnwindSafe,
impl<D, V> Send for SubgraphWccs<D, V>
impl<D, V> Sync for SubgraphWccs<D, V>
impl<D, V> Unpin for SubgraphWccs<D, V>
impl<D, V> UnwindSafe for SubgraphWccs<D, V>where
V: UnwindSafe,
D: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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> 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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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