pub struct BvGraph<F> { /* private fields */ }Expand description
A random-access graph in the BV format.
The graph depends on a RandomAccessDecoderFactory that can be used to
create decoders for the graph. This allows to decouple the graph from the
underlying storage format, and to use different storage formats for the same
graph. For example, one can use a memory-mapped file for the graph, or load
it in memory, or even generate it on the fly.
Note that the knowledge of the codes used by the graph is in the factory, which provides methods to read each component of the BV format (outdegree, reference offset, block count, etc.), whereas the knowledge of the compression parameters (compression window and minimum interval length) is in this structure.
Implementations§
Source§impl BvGraph<()>
impl BvGraph<()>
Sourcepub fn with_basename(
basename: impl AsRef<Path>,
) -> LoadConfig<BE, Random, Dynamic, Mmap, Mmap>
pub fn with_basename( basename: impl AsRef<Path>, ) -> LoadConfig<BE, Random, Dynamic, Mmap, Mmap>
Returns a load configuration that can be customized.
Source§impl<E: Endianness, F: CodesReaderFactoryHelper<E>, OFF: Offsets> BvGraph<DynCodesDecoderFactory<E, F, OFF>>
impl<E: Endianness, F: CodesReaderFactoryHelper<E>, OFF: Offsets> BvGraph<DynCodesDecoderFactory<E, F, OFF>>
Sourcepub fn offsets_to_slice(
self,
) -> BvGraph<DynCodesDecoderFactory<E, F, Owned<Box<[usize]>>>>
pub fn offsets_to_slice( self, ) -> BvGraph<DynCodesDecoderFactory<E, F, Owned<Box<[usize]>>>>
Remaps the offsets in a slice of usize.
This method is mainly useful for benchmarking and testing purposes, as
representing the offsets as a slice increasing significantly the
memory footprint. It just replaces current decoder factory with
the result of DynCodesDecoderFactory::offsets_to_slice.
Source§impl<E: Endianness, F: CodesReaderFactoryHelper<E>, OFF: Offsets> BvGraph<ConstCodesDecoderFactory<E, F, OFF>>
impl<E: Endianness, F: CodesReaderFactoryHelper<E>, OFF: Offsets> BvGraph<ConstCodesDecoderFactory<E, F, OFF>>
Sourcepub fn offsets_to_slice(
self,
) -> BvGraph<ConstCodesDecoderFactory<E, F, Owned<Box<[usize]>>>>
pub fn offsets_to_slice( self, ) -> BvGraph<ConstCodesDecoderFactory<E, F, Owned<Box<[usize]>>>>
Remaps the offsets in a slice of usize.
This method is mainly useful for benchmarking and testing purposes, as
representing the offsets as a slice increasing significantly the
memory footprint. It just replaces current decoder factory with
the result of ConstCodesDecoderFactory::offsets_to_slice.
Source§impl<F> BvGraph<F>where
F: RandomAccessDecoderFactory,
impl<F> BvGraph<F>where
F: RandomAccessDecoderFactory,
Sourcepub fn new(
factory: F,
number_of_nodes: usize,
number_of_arcs: u64,
compression_window: usize,
min_interval_length: usize,
) -> Self
pub fn new( factory: F, number_of_nodes: usize, number_of_arcs: u64, compression_window: usize, min_interval_length: usize, ) -> Self
Creates a new BvGraph from the given parameters.
§Arguments
reader_factory: backend that can create objects that allows us to read the bitstream of the graph to decode the edges.offsets: the bit offset at which we will have to start for decoding the edges of each node. (This is needed for the random accesses,BvGraphSeqdoes not need them)min_interval_length: the minimum size of the intervals we are going to decode.compression_window: the maximum distance between two nodes that reference each other.number_of_nodes: the number of nodes in the graph.number_of_arcs: the number of arcs in the graph.
Sourcepub fn into_inner(self) -> F
pub fn into_inner(self) -> F
Consumes self and returns the factory.
Source§impl<F: SequentialDecoderFactory> BvGraph<F>
impl<F: SequentialDecoderFactory> BvGraph<F>
Sourcepub fn offset_deg_iter(&self) -> OffsetDegIter<F::Decoder<'_>> ⓘ
pub fn offset_deg_iter(&self) -> OffsetDegIter<F::Decoder<'_>> ⓘ
Creates an iterator specialized in the degrees of the nodes. This is slightly faster because it can avoid decoding some of the nodes and completely skip the merging step.
Source§impl<F: RandomAccessDecoderFactory> BvGraph<F>
impl<F: RandomAccessDecoderFactory> BvGraph<F>
Sourcepub fn offset_deg_iter_from(&self, node: usize) -> OffsetDegIter<F::Decoder<'_>> ⓘ
pub fn offset_deg_iter_from(&self, node: usize) -> OffsetDegIter<F::Decoder<'_>> ⓘ
Creates an iterator specialized in the degrees of the nodes starting from a given node.
Trait Implementations§
Source§impl<'a, F: RandomAccessDecoderFactory> IntoLender for &'a BvGraph<F>
Convenience implementation that makes it possible to iterate over a
BvGraphSeq using the for_ macro (see the
crate documentation).
impl<'a, F: RandomAccessDecoderFactory> IntoLender for &'a BvGraph<F>
Convenience implementation that makes it possible to iterate over a
BvGraphSeq using the for_ macro (see the
crate documentation).
Source§impl<F> RandomAccessGraph for BvGraph<F>where
F: RandomAccessDecoderFactory,
impl<F> RandomAccessGraph for BvGraph<F>where
F: RandomAccessDecoderFactory,
Source§impl<F> RandomAccessLabeling for BvGraph<F>where
F: RandomAccessDecoderFactory,
impl<F> RandomAccessLabeling for BvGraph<F>where
F: RandomAccessDecoderFactory,
Source§impl<F> SequentialLabeling for BvGraph<F>where
F: RandomAccessDecoderFactory,
impl<F> SequentialLabeling for BvGraph<F>where
F: RandomAccessDecoderFactory,
Source§fn iter_from(&self, start_node: usize) -> Self::Lender<'_>
fn iter_from(&self, start_node: usize) -> Self::Lender<'_>
Returns a fast sequential iterator over the nodes of the graph and their successors.
type Label = usize
Source§type Lender<'b> = NodeLabels<<F as RandomAccessDecoderFactory>::Decoder<'b>>
where
Self: 'b,
F: 'b
type Lender<'b> = NodeLabels<<F as RandomAccessDecoderFactory>::Decoder<'b>> where Self: 'b, F: 'b
Source§fn num_arcs_hint(&self) -> Option<u64>
fn num_arcs_hint(&self) -> Option<u64>
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
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
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: for<'a> Succ<Input = usize, Output<'a> = usize>>(
&self,
func: F,
fold: R,
granularity: Granularity,
deg_cumul: &D,
pl: &mut impl ConcurrentProgressLog,
) -> A
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
func to each chunk of nodes containing approximately
arc_granularity arcs in parallel and folds the results using fold. Read moreSource§impl<F: RandomAccessDecoderFactory> SplitLabeling for BvGraph<F>
impl<F: RandomAccessDecoderFactory> SplitLabeling for BvGraph<F>
type SplitLender<'a> = Take<<BvGraph<F> as SequentialLabeling>::Lender<'a>> where Self: 'a
type IntoIterator<'a> = Iter<'a, BvGraph<F>> where Self: 'a
fn split_iter(&self, how_many: usize) -> Self::IntoIterator<'_>
impl<F> SequentialGraph for BvGraph<F>where
F: RandomAccessDecoderFactory,
Auto Trait Implementations§
impl<F> Freeze for BvGraph<F>where
F: Freeze,
impl<F> RefUnwindSafe for BvGraph<F>where
F: RefUnwindSafe,
impl<F> Send for BvGraph<F>where
F: Send,
impl<F> Sync for BvGraph<F>where
F: Sync,
impl<F> Unpin for BvGraph<F>where
F: Unpin,
impl<F> UnsafeUnpin for BvGraph<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for BvGraph<F>where
F: 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