Skip to main content

CsrSortedGraph

Struct CsrSortedGraph 

Source
pub struct CsrSortedGraph<DCF = Box<[usize]>, S = Box<[usize]>>(/* private fields */);
Expand description

A wrapper for a CsrGraph with the additional guarantee that the successors are sorted.

Implementations§

Source§

impl CsrSortedGraph

Source

pub fn from_lender<I: IntoLender>(iter_nodes: I) -> Self
where I::Lender: for<'next> NodeLabelsLender<'next, Label = usize> + SortedLender, for<'succ> LenderIntoIter<'succ, I::Lender>: SortedIterator,

Creates a new sorted CSR graph from an IntoLender yielding a sorted NodeLabelsLender with sorted successors.

Source

pub fn from_seq_graph<G: SequentialGraph>(g: &G) -> Self
where for<'a> G::Lender<'a>: SortedLender, for<'a, 'b> LenderIntoIter<'b, G::Lender<'a>>: SortedIterator,

Creates a new sorted CSR graph from a SequentialGraph with sorted lenders and sorted successors.

Source§

impl CsrSortedGraph<EliasFano<SelectAdaptConst<BitVec<Box<[usize]>>, Box<[usize]>, 12, 4>>, BitFieldVec>

Source

pub fn try_from_graph<G: SequentialGraph>(g: &G) -> Result<Self>
where for<'a> G::Lender<'a>: SortedLender, for<'a, 'b> LenderIntoIter<'b, G::Lender<'a>>: SortedIterator,

Creates a new compressed CSR sorted graph from a sequential graph with sorted lender, sorted successors, and providing the number of arcs.

This method will return an error if the graph does not provide the number of arcs.

Trait Implementations§

Source§

impl<DCF, S> AlignHash for CsrSortedGraph<DCF, S>
where CsrGraph<DCF, S>: 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<DCF: Clone, S: Clone> Clone for CsrSortedGraph<DCF, S>

Source§

fn clone(&self) -> CsrSortedGraph<DCF, S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<DCF, S> CopyType for CsrSortedGraph<DCF, S>

Source§

impl<DCF: Debug, S: Debug> Debug for CsrSortedGraph<DCF, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<DCF, S> DeserInner for CsrSortedGraph<DCF, S>
where CsrGraph<DCF, S>: DeserInner,

Source§

type DeserType<'__epserde_desertype> = CsrSortedGraph<DCF, S>

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

fn __check_covariance<'__long: '__short, '__short>( proof: CovariantProof<Self::DeserType<'__long>>, ) -> CovariantProof<Self::DeserType<'__short>>

Compile-time covariance check for DeserType. Read more
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<'a, DCF, S> IntoLender for &'a CsrSortedGraph<DCF, S>

Convenience implementation that makes it possible to iterate over the graph using the for_ macro (see the crate documentation).

Source§

type Lender = <&'a CsrSortedGraph<DCF, S> as SequentialLabeling>::Lender<'a>

The lender type that this type converts into.
Source§

fn into_lender(self) -> Self::Lender

Converts this type into a Lender.
Source§

impl<DCF, S> RandomAccessGraph for CsrSortedGraph<DCF, S>
where DCF: SliceByValue<Value = usize> + IterateByValueFrom<Item = usize>, S: SliceByValue<Value = usize> + IterateByValueFrom<Item = usize>,

Source§

fn successors( &self, node_id: usize, ) -> <Self as RandomAccessLabeling>::Labels<'_>

Returns the successors of a node. Read more
Source§

fn has_arc(&self, src_node_id: usize, dst_node_id: usize) -> bool

Returns whether there is an arc going from src_node_id to dst_node_id. Read more
Source§

impl<DCF, S> RandomAccessLabeling for CsrSortedGraph<DCF, S>
where DCF: SliceByValue<Value = usize> + IterateByValueFrom<Item = usize>, S: SliceByValue<Value = usize> + IterateByValueFrom<Item = usize>,

Source§

type Labels<'succ> = AssumeSortedIterator<Take<<S as IterateByValueFromGat<'succ>>::IterFrom>> where Self: 'succ

The type of the iterator over the labels of a node returned by labels.
Source§

fn num_arcs(&self) -> u64

Returns the number of arcs in the graph.
Source§

fn outdegree(&self, node: usize) -> usize

Returns the number of labels associated with a node.
Source§

fn labels(&self, node: usize) -> <Self as RandomAccessLabeling>::Labels<'_>

Returns the labels associated with a node.
Source§

impl<DCF, S> SequentialLabeling for CsrSortedGraph<DCF, S>

Source§

type Label = usize

Source§

type Lender<'a> = LenderSortedImpl<<DCF as IterateByValueFromGat<'a>>::IterFrom, <S as IterateByValueFromGat<'a>>::IterFrom> where Self: 'a

The type of Lender over the successors of a node returned by iter.
Source§

fn num_nodes(&self) -> usize

Returns the number of nodes in the graph.
Source§

fn num_arcs_hint(&self) -> Option<u64>

Returns the number of arcs in the graph, if available.
Source§

fn iter_from(&self, from: usize) -> Self::Lender<'_>

Returns an iterator over the labeling starting at from (included). Read more
Source§

fn build_dcf(&self) -> DCF

Builds the degree cumulative function for this labeling. Read more
Source§

fn iter(&self) -> Self::Lender<'_>

Returns an iterator over the labeling. Read more
Source§

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, pl: &mut impl ConcurrentProgressLog, ) -> A

Applies func to each chunk of nodes of size node_granularity in parallel, and folds the results using fold. Read more
Source§

fn par_apply<F: Fn(Range<usize>) -> A + Sync, A: Default + Send, R: Fn(A, A) -> A + Sync, D: for<'a> Succ<Input = usize, Output<'a> = usize>>( &self, func: F, fold: R, granularity: Granularity, deg_cumul: &D, pl: &mut impl ConcurrentProgressLog, ) -> A

Applies func to each chunk of nodes containing approximately arc_granularity arcs in parallel and folds the results using fold. Read more
Source§

impl<DCF, S> SerInner for CsrSortedGraph<DCF, S>
where CsrGraph<DCF, S>: SerInner,

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 = CsrSortedGraph<DCF, S>

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<DCF, S> TypeHash for CsrSortedGraph<DCF, S>
where CsrGraph<DCF, S>: 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.
Source§

impl<D, S> SequentialGraph for CsrSortedGraph<D, S>

Auto Trait Implementations§

§

impl<DCF, S> Freeze for CsrSortedGraph<DCF, S>
where DCF: Freeze, S: Freeze,

§

impl<DCF, S> RefUnwindSafe for CsrSortedGraph<DCF, S>

§

impl<DCF, S> Send for CsrSortedGraph<DCF, S>
where DCF: Send, S: Send,

§

impl<DCF, S> Sync for CsrSortedGraph<DCF, S>
where DCF: Sync, S: Sync,

§

impl<DCF, S> Unpin for CsrSortedGraph<DCF, S>
where DCF: Unpin, S: Unpin,

§

impl<DCF, S> UnsafeUnpin for CsrSortedGraph<DCF, S>
where DCF: UnsafeUnpin, S: UnsafeUnpin,

§

impl<DCF, S> UnwindSafe for CsrSortedGraph<DCF, S>
where DCF: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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)
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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

Source§

fn splat(value: T) -> T

Source§

impl<T> To<T> for T

Source§

fn to(self) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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