pub struct SwhUnidirectionalGraph<P, G: UnderlyingGraph = BVGraph<DynCodesDecoderFactory<BE, MmapHelper<u32>, EliasFano<SelectFixed2<CountBitVec<&'static [usize]>, &'static [u64], 8>, BitFieldVec<usize, &'static [usize]>>>>> { /* private fields */ }
Expand description

Class representing the compressed Software Heritage graph in a single direction.

Created using load_unidirectional.

Type parameters:

Implementations§

source§

impl<G: UnderlyingGraph> SwhUnidirectionalGraph<(), G>

source

pub fn from_underlying_graph(basepath: PathBuf, graph: G) -> Self

source§

impl<M: MaybeMaps, T: MaybeTimestamps, P: MaybePersons, C: MaybeContents, S: MaybeStrings, N: MaybeLabelNames, G: UnderlyingGraph> SwhUnidirectionalGraph<SwhGraphProperties<M, T, P, C, S, N>, G>

source

pub fn load_properties<M2: MaybeMaps, T2: MaybeTimestamps, P2: MaybePersons, C2: MaybeContents, S2: MaybeStrings, N2: MaybeLabelNames>( self, loader: impl Fn(SwhGraphProperties<M, T, P, C, S, N>) -> Result<SwhGraphProperties<M2, T2, P2, C2, S2, N2>> ) -> Result<SwhUnidirectionalGraph<SwhGraphProperties<M2, T2, P2, C2, S2, N2>, G>>

Enriches the graph with more properties mmapped from disk

Example
use swh_graph::java_compat::mph::gov::GOVMPH;

swh_graph::graph::load_unidirectional(PathBuf::from("./graph"))
    .expect("Could not load graph")
    .init_properties()
    .load_properties(|properties| properties.load_maps::<GOVMPH>())
    .expect("Could not load SWHID maps")
    .load_properties(|properties| properties.load_timestamps())
    .expect("Could not load timestamps");
source§

impl<G: UnderlyingGraph> SwhUnidirectionalGraph<(), G>

source

pub fn init_properties( self ) -> SwhUnidirectionalGraph<SwhGraphProperties<NoMaps, NoTimestamps, NoPersons, NoContents, NoStrings, NoLabelNames>, G>

Prerequisite for load_properties

source

pub fn load_all_properties<MPHF: SwhidMphf>( self ) -> Result<SwhUnidirectionalGraph<SwhGraphProperties<MappedMaps<MPHF>, MappedTimestamps, MappedPersons, MappedContents, MappedStrings, MappedLabelNames>, G>>

Enriches the graph with more properties mmapped from disk

Example
use swh_graph::java_compat::mph::gov::GOVMPH;

swh_graph::graph::load_unidirectional(PathBuf::from("./graph"))
    .expect("Could not load graph")
    .load_all_properties::<GOVMPH>()
    .expect("Could not load properties");
source§

impl<P, G: RandomAccessGraph + UnderlyingGraph> SwhUnidirectionalGraph<P, G>

source

pub fn load_labels( self ) -> Result<SwhUnidirectionalGraph<P, Zip<G, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>>>

Consumes this graph and returns a new one that implements SwhLabelledForwardGraph

Trait Implementations§

source§

impl<P, G: UnderlyingGraph> SwhForwardGraph for SwhUnidirectionalGraph<P, G>

source§

fn successors(&self, node_id: NodeId) -> Self::Successors<'_>

Return an IntoIterator over the successors of a node.

source§

fn outdegree(&self, node_id: NodeId) -> usize

Return the number of successors of a node.

§

type Successors<'succ> = <G as UnderlyingGraph>::UnlabeledSuccessors<'succ> where Self: 'succ

source§

impl<P, G: UnderlyingGraph> SwhGraph for SwhUnidirectionalGraph<P, G>

source§

fn path(&self) -> &Path

Return the base path of the graph
source§

fn is_transposed(&self) -> bool

Returns whether the graph is in the ori->snp->rel,rev->dir->cnt direction (with a few dir->rev arcs)
source§

fn num_nodes(&self) -> usize

Return the number of nodes in the graph.
source§

fn num_arcs(&self) -> u64

Return the number of arcs in the graph.
source§

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

Return whether there is an arc going from src_node_id to dst_node_id.
source§

fn has_node(&self, node_id: NodeId) -> bool

Returns whether the given node id exists in the graph Read more
source§

impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames, G: UnderlyingGraph> SwhGraphWithProperties for SwhUnidirectionalGraph<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>, G>

§

type Maps = MAPS

§

type Timestamps = TIMESTAMPS

§

type Persons = PERSONS

§

type Contents = CONTENTS

§

type Strings = STRINGS

§

type LabelNames = LABELNAMES

source§

fn properties( &self ) -> &SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>

source§

impl<P, G: UnderlyingGraph> SwhLabelledForwardGraph for SwhUnidirectionalGraph<P, G>where <G as SequentialLabeling>::Label: Pair<Left = NodeId>, <<G as SequentialLabeling>::Label as Pair>::Right: IntoIterator, <<<G as SequentialLabeling>::Label as Pair>::Right as IntoIterator>::Item: Borrow<u64>, for<'succ> <G as RandomAccessLabeling>::Labels<'succ>: Iterator<Item = (usize, <<G as SequentialLabeling>::Label as Pair>::Right)>,

§

type LabelledArcs<'arc> = LabelledArcIterator<<<<<G as RandomAccessLabeling>::Labels<'arc> as Iterator>::Item as Pair>::Right as IntoIterator>::IntoIter> where Self: 'arc

§

type LabelledSuccessors<'succ> = LabelledSuccessorIterator<<G as RandomAccessLabeling>::Labels<'succ>> where Self: 'succ

source§

fn labelled_successors(&self, node_id: NodeId) -> Self::LabelledSuccessors<'_>

Return an IntoIterator over the successors of a node.

Auto Trait Implementations§

§

impl<P, G> RefUnwindSafe for SwhUnidirectionalGraph<P, G>where G: RefUnwindSafe, P: RefUnwindSafe,

§

impl<P, G> Send for SwhUnidirectionalGraph<P, G>where G: Send, P: Send,

§

impl<P, G> Sync for SwhUnidirectionalGraph<P, G>where G: Sync, P: Sync,

§

impl<P, G> Unpin for SwhUnidirectionalGraph<P, G>where G: Unpin, P: Unpin,

§

impl<P, G> UnwindSafe for SwhUnidirectionalGraph<P, G>where G: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> CastableFrom<T> for T

§

fn cast_from(value: T) -> T

Call Self as W
§

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

§

fn cast(self) -> U

Call W::cast_from(self)
§

impl<T> DowncastableFrom<T> for T

§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
§

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

§

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.

§

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

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

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

§

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>).
§

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§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Splat<T> for T

§

fn splat(value: T) -> T

§

impl<T> To<T> for T

§

fn to(self) -> T

source§

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

§

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 Twhere U: TryFrom<T>,

§

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

impl<T> UpcastableFrom<T> for T

§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
§

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

§

fn upcast(self) -> U

Call W::upcast_from(self)
§

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

§

fn vzip(self) -> V

§

impl<T> Allocation for Twhere T: RefUnwindSafe + Send + Sync,