Struct swh_graph::graph::SwhBidirectionalGraph
source · pub struct SwhBidirectionalGraph<P, FG: UnderlyingGraph = BVGraph<DynCodesDecoderFactory<BE, MmapHelper<u32>, EliasFano<SelectFixed2<CountBitVec<&'static [usize]>, &'static [u64], 8>, BitFieldVec<usize, &'static [usize]>>>>, BG: 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 both directions.
Created using load_bidirectional
.
Type parameters:
P
is either()
orproperties::SwhGraphProperties
, manipulated usingload_properties
andload_all_properties
- FG is the forward graph (either [
BVGraph
], orZip<BVGraph, SwhGraphLabels>
after usingload_forward_labels
- BG is the backward graph (either [
BVGraph
], orZip<BVGraph, SwhGraphLabels>
after usingload_backward_labels
Implementations§
source§impl<FG: UnderlyingGraph, BG: UnderlyingGraph> SwhBidirectionalGraph<(), FG, BG>
impl<FG: UnderlyingGraph, BG: UnderlyingGraph> SwhBidirectionalGraph<(), FG, BG>
pub fn from_underlying_graphs( basepath: PathBuf, forward_graph: FG, backward_graph: BG ) -> Self
source§impl<M: MaybeMaps, T: MaybeTimestamps, P: MaybePersons, C: MaybeContents, S: MaybeStrings, N: MaybeLabelNames, BG: UnderlyingGraph, FG: UnderlyingGraph> SwhBidirectionalGraph<SwhGraphProperties<M, T, P, C, S, N>, FG, BG>
impl<M: MaybeMaps, T: MaybeTimestamps, P: MaybePersons, C: MaybeContents, S: MaybeStrings, N: MaybeLabelNames, BG: UnderlyingGraph, FG: UnderlyingGraph> SwhBidirectionalGraph<SwhGraphProperties<M, T, P, C, S, N>, FG, BG>
sourcepub 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<SwhBidirectionalGraph<SwhGraphProperties<M2, T2, P2, C2, S2, N2>, FG, BG>>
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<SwhBidirectionalGraph<SwhGraphProperties<M2, T2, P2, C2, S2, N2>, FG, BG>>
Enriches the graph with more properties mmapped from disk
Example
use swh_graph::java_compat::mph::gov::GOVMPH;
use swh_graph::SwhGraphProperties;
swh_graph::graph::load_bidirectional(PathBuf::from("./graph"))
.expect("Could not load graph")
.init_properties()
.load_properties(SwhGraphProperties::load_maps::<GOVMPH>)
.expect("Could not load SWHID maps")
.load_properties(SwhGraphProperties::load_timestamps)
.expect("Could not load timestamps");
source§impl<FG: UnderlyingGraph, BG: UnderlyingGraph> SwhBidirectionalGraph<(), FG, BG>
impl<FG: UnderlyingGraph, BG: UnderlyingGraph> SwhBidirectionalGraph<(), FG, BG>
sourcepub fn init_properties(
self
) -> SwhBidirectionalGraph<SwhGraphProperties<NoMaps, NoTimestamps, NoPersons, NoContents, NoStrings, NoLabelNames>, FG, BG>
pub fn init_properties( self ) -> SwhBidirectionalGraph<SwhGraphProperties<NoMaps, NoTimestamps, NoPersons, NoContents, NoStrings, NoLabelNames>, FG, BG>
Prerequisite for load_properties
sourcepub fn load_all_properties<MPHF: SwhidMphf>(
self
) -> Result<SwhBidirectionalGraph<SwhGraphProperties<MappedMaps<MPHF>, MappedTimestamps, MappedPersons, MappedContents, MappedStrings, MappedLabelNames>, FG, BG>>
pub fn load_all_properties<MPHF: SwhidMphf>( self ) -> Result<SwhBidirectionalGraph<SwhGraphProperties<MappedMaps<MPHF>, MappedTimestamps, MappedPersons, MappedContents, MappedStrings, MappedLabelNames>, FG, BG>>
Enriches the graph with more properties mmapped from disk
Example
use swh_graph::java_compat::mph::gov::GOVMPH;
swh_graph::graph::load_bidirectional(PathBuf::from("./graph"))
.expect("Could not load graph")
.load_all_properties::<GOVMPH>()
.expect("Could not load properties");
source§impl<P, FG: RandomAccessGraph + UnderlyingGraph, BG: UnderlyingGraph> SwhBidirectionalGraph<P, FG, BG>
impl<P, FG: RandomAccessGraph + UnderlyingGraph, BG: UnderlyingGraph> SwhBidirectionalGraph<P, FG, BG>
sourcepub fn load_forward_labels(
self
) -> Result<SwhBidirectionalGraph<P, Zip<FG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>, BG>>
pub fn load_forward_labels( self ) -> Result<SwhBidirectionalGraph<P, Zip<FG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>, BG>>
Consumes this graph and returns a new one that implements SwhLabelledForwardGraph
source§impl<P, FG: UnderlyingGraph, BG: RandomAccessGraph + UnderlyingGraph> SwhBidirectionalGraph<P, FG, BG>
impl<P, FG: UnderlyingGraph, BG: RandomAccessGraph + UnderlyingGraph> SwhBidirectionalGraph<P, FG, BG>
sourcepub fn load_backward_labels(
self
) -> Result<SwhBidirectionalGraph<P, FG, Zip<BG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>>>
pub fn load_backward_labels( self ) -> Result<SwhBidirectionalGraph<P, FG, Zip<BG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>>>
Consumes this graph and returns a new one that implements SwhLabelledBackwardGraph
source§impl<P, FG: RandomAccessGraph + UnderlyingGraph, BG: RandomAccessGraph + UnderlyingGraph> SwhBidirectionalGraph<P, FG, BG>
impl<P, FG: RandomAccessGraph + UnderlyingGraph, BG: RandomAccessGraph + UnderlyingGraph> SwhBidirectionalGraph<P, FG, BG>
sourcepub fn load_labels(
self
) -> Result<SwhBidirectionalGraph<P, Zip<FG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>, Zip<BG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>>>
pub fn load_labels( self ) -> Result<SwhBidirectionalGraph<P, Zip<FG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>, Zip<BG, SwhLabels<MmapReaderBuilder, DeserType<'static, EF>>>>>
Equivalent to calling both
load_forward_labels
and
load_backward_labels
Trait Implementations§
source§impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhBackwardGraph for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhBackwardGraph for SwhBidirectionalGraph<P, FG, BG>
type Predecessors<'succ> = <BG as UnderlyingGraph>::UnlabeledSuccessors<'succ> where Self: 'succ
source§fn predecessors(&self, node_id: NodeId) -> Self::Predecessors<'_>
fn predecessors(&self, node_id: NodeId) -> Self::Predecessors<'_>
Return an
IntoIterator
over the predecessors of a node.source§impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhForwardGraph for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhForwardGraph for SwhBidirectionalGraph<P, FG, BG>
type Successors<'succ> = <FG as UnderlyingGraph>::UnlabeledSuccessors<'succ> where Self: 'succ
source§fn successors(&self, node_id: NodeId) -> Self::Successors<'_>
fn successors(&self, node_id: NodeId) -> Self::Successors<'_>
Return an
IntoIterator
over the successors of a node.source§impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhGraph for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhGraph for SwhBidirectionalGraph<P, FG, BG>
source§impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames, BG: UnderlyingGraph, FG: UnderlyingGraph> SwhGraphWithProperties for SwhBidirectionalGraph<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>, FG, BG>
impl<MAPS: MaybeMaps, TIMESTAMPS: MaybeTimestamps, PERSONS: MaybePersons, CONTENTS: MaybeContents, STRINGS: MaybeStrings, LABELNAMES: MaybeLabelNames, BG: UnderlyingGraph, FG: UnderlyingGraph> SwhGraphWithProperties for SwhBidirectionalGraph<SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>, FG, BG>
type Maps = MAPS
type Timestamps = TIMESTAMPS
type Persons = PERSONS
type Contents = CONTENTS
type Strings = STRINGS
type LabelNames = LABELNAMES
fn properties( &self ) -> &SwhGraphProperties<MAPS, TIMESTAMPS, PERSONS, CONTENTS, STRINGS, LABELNAMES>
source§impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhLabelledBackwardGraph for SwhBidirectionalGraph<P, FG, BG>where
<BG as SequentialLabeling>::Label: Pair<Left = NodeId>,
<<BG as SequentialLabeling>::Label as Pair>::Right: IntoIterator,
<<<BG as SequentialLabeling>::Label as Pair>::Right as IntoIterator>::Item: Borrow<u64>,
for<'succ> <BG as RandomAccessLabeling>::Labels<'succ>: Iterator<Item = (usize, <<BG as SequentialLabeling>::Label as Pair>::Right)>,
impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhLabelledBackwardGraph for SwhBidirectionalGraph<P, FG, BG>where <BG as SequentialLabeling>::Label: Pair<Left = NodeId>, <<BG as SequentialLabeling>::Label as Pair>::Right: IntoIterator, <<<BG as SequentialLabeling>::Label as Pair>::Right as IntoIterator>::Item: Borrow<u64>, for<'succ> <BG as RandomAccessLabeling>::Labels<'succ>: Iterator<Item = (usize, <<BG as SequentialLabeling>::Label as Pair>::Right)>,
type LabelledArcs<'arc> = LabelledArcIterator<<<<<BG as RandomAccessLabeling>::Labels<'arc> as Iterator>::Item as Pair>::Right as IntoIterator>::IntoIter> where Self: 'arc
type LabelledPredecessors<'succ> = LabelledSuccessorIterator<<BG as RandomAccessLabeling>::Labels<'succ>> where Self: 'succ
source§fn labelled_predecessors(
&self,
node_id: NodeId
) -> Self::LabelledPredecessors<'_>
fn labelled_predecessors( &self, node_id: NodeId ) -> Self::LabelledPredecessors<'_>
Return an
IntoIterator
over the successors of a node.source§impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhLabelledForwardGraph for SwhBidirectionalGraph<P, FG, BG>where
<FG as SequentialLabeling>::Label: Pair<Left = NodeId>,
<<FG as SequentialLabeling>::Label as Pair>::Right: IntoIterator,
<<<FG as SequentialLabeling>::Label as Pair>::Right as IntoIterator>::Item: Borrow<u64>,
for<'succ> <FG as RandomAccessLabeling>::Labels<'succ>: Iterator<Item = (usize, <<FG as SequentialLabeling>::Label as Pair>::Right)>,
impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhLabelledForwardGraph for SwhBidirectionalGraph<P, FG, BG>where <FG as SequentialLabeling>::Label: Pair<Left = NodeId>, <<FG as SequentialLabeling>::Label as Pair>::Right: IntoIterator, <<<FG as SequentialLabeling>::Label as Pair>::Right as IntoIterator>::Item: Borrow<u64>, for<'succ> <FG as RandomAccessLabeling>::Labels<'succ>: Iterator<Item = (usize, <<FG as SequentialLabeling>::Label as Pair>::Right)>,
type LabelledArcs<'arc> = LabelledArcIterator<<<<<FG as RandomAccessLabeling>::Labels<'arc> as Iterator>::Item as Pair>::Right as IntoIterator>::IntoIter> where Self: 'arc
type LabelledSuccessors<'succ> = LabelledSuccessorIterator<<FG as RandomAccessLabeling>::Labels<'succ>> where Self: 'succ
source§fn labelled_successors(&self, node_id: NodeId) -> Self::LabelledSuccessors<'_>
fn labelled_successors(&self, node_id: NodeId) -> Self::LabelledSuccessors<'_>
Return an
IntoIterator
over the successors of a node.Auto Trait Implementations§
impl<P, FG, BG> RefUnwindSafe for SwhBidirectionalGraph<P, FG, BG>where BG: RefUnwindSafe, FG: RefUnwindSafe, P: RefUnwindSafe,
impl<P, FG, BG> Send for SwhBidirectionalGraph<P, FG, BG>where BG: Send, FG: Send, P: Send,
impl<P, FG, BG> Sync for SwhBidirectionalGraph<P, FG, BG>where BG: Sync, FG: Sync, P: Sync,
impl<P, FG, BG> Unpin for SwhBidirectionalGraph<P, FG, BG>where BG: Unpin, FG: Unpin, P: Unpin,
impl<P, FG, BG> UnwindSafe for SwhBidirectionalGraph<P, FG, BG>where BG: UnwindSafe, FG: UnwindSafe, P: 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
Mutably borrows from an owned value. Read more
§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere U: CastableFrom<T>,
§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
§fn downcast_from(value: T) -> 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>,
impl<T, U> DowncastableInto<U> for Twhere U: DowncastableFrom<T>,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere T: ?Sized,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> UpcastableFrom<T> for T
impl<T> UpcastableFrom<T> for T
§fn upcast_from(value: T) -> T
fn upcast_from(value: T) -> T
Extend the current UnsignedInt to a possibly bigger size.