Struct swh_graph::graph::SwhBidirectionalGraph
source · pub struct SwhBidirectionalGraph<P, FG: UnderlyingGraph = DefaultUnderlyingGraph, BG: UnderlyingGraph = DefaultUnderlyingGraph> { /* private fields */ }
Expand description
Class representing the compressed Software Heritage graph in both directions.
Type parameters:
P
is either()
orproperties::SwhGraphProperties
, manipulated usingload_properties
andload_all_properties
- FG is the forward graph (either
BvGraph
, orZip<BvGraph, SwhLabeling>
after usingload_forward_labels
- BG is the backward graph (either
BvGraph
, orZip<BvGraph, SwhLabeling>
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::SwhBidirectionalGraph::new(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::SwhBidirectionalGraph::new(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, SwhLabeling>, BG>>
pub fn load_forward_labels( self, ) -> Result<SwhBidirectionalGraph<P, Zip<FG, SwhLabeling>, BG>>
Consumes this graph and returns a new one that implements SwhLabeledForwardGraph
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, SwhLabeling>>>
pub fn load_backward_labels( self, ) -> Result<SwhBidirectionalGraph<P, FG, Zip<BG, SwhLabeling>>>
Consumes this graph and returns a new one that implements SwhLabeledBackwardGraph
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, SwhLabeling>, Zip<BG, SwhLabeling>>>
pub fn load_labels( self, ) -> Result<SwhBidirectionalGraph<P, Zip<FG, SwhLabeling>, Zip<BG, SwhLabeling>>>
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>
source§impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhLabeledBackwardGraph for SwhBidirectionalGraph<P, FG, BG>where
<BG as SequentialLabeling>::Label: Pair<Left = NodeId, Right: 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> SwhLabeledBackwardGraph for SwhBidirectionalGraph<P, FG, BG>where
<BG as SequentialLabeling>::Label: Pair<Left = NodeId, Right: IntoIterator<Item: Borrow<u64>>>,
for<'succ> <BG as RandomAccessLabeling>::Labels<'succ>: Iterator<Item = (usize, <<BG as SequentialLabeling>::Label as Pair>::Right)>,
type LabeledArcs<'arc> = LabeledArcIterator<<<<<BG as RandomAccessLabeling>::Labels<'arc> as Iterator>::Item as Pair>::Right as IntoIterator>::IntoIter> where Self: 'arc
type LabeledPredecessors<'succ> = LabeledSuccessorIterator<<BG as RandomAccessLabeling>::Labels<'succ>> where Self: 'succ
source§fn untyped_labeled_predecessors(
&self,
node_id: NodeId,
) -> Self::LabeledPredecessors<'_>
fn untyped_labeled_predecessors( &self, node_id: NodeId, ) -> Self::LabeledPredecessors<'_>
Return an
IntoIterator
over the predecessors of a node along with a list of labels
of each arcsource§impl<P, FG: UnderlyingGraph, BG: UnderlyingGraph> SwhLabeledForwardGraph for SwhBidirectionalGraph<P, FG, BG>where
<FG as SequentialLabeling>::Label: Pair<Left = NodeId, Right: 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> SwhLabeledForwardGraph for SwhBidirectionalGraph<P, FG, BG>where
<FG as SequentialLabeling>::Label: Pair<Left = NodeId, Right: IntoIterator<Item: Borrow<u64>>>,
for<'succ> <FG as RandomAccessLabeling>::Labels<'succ>: Iterator<Item = (usize, <<FG as SequentialLabeling>::Label as Pair>::Right)>,
type LabeledArcs<'arc> = LabeledArcIterator<<<<<FG as RandomAccessLabeling>::Labels<'arc> as Iterator>::Item as Pair>::Right as IntoIterator>::IntoIter> where Self: 'arc
type LabeledSuccessors<'succ> = LabeledSuccessorIterator<<FG as RandomAccessLabeling>::Labels<'succ>> where Self: 'succ
source§fn untyped_labeled_successors(
&self,
node_id: NodeId,
) -> Self::LabeledSuccessors<'_>
fn untyped_labeled_successors( &self, node_id: NodeId, ) -> Self::LabeledSuccessors<'_>
Return an
IntoIterator
over the successors of a node along with a list of labels
of each arcAuto Trait Implementations§
impl<P, FG, BG> Freeze for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG, BG> RefUnwindSafe for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG, BG> Send for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG, BG> Sync for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG, BG> Unpin for SwhBidirectionalGraph<P, FG, BG>
impl<P, FG, BG> UnwindSafe for SwhBidirectionalGraph<P, FG, BG>
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
source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<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
Truncate the current UnsignedInt to a possibly smaller size
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
Truncate the current UnsignedInt to a possibly smaller size
source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<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> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.source§impl<T> UpcastableFrom<T> for T
impl<T> UpcastableFrom<T> for T
source§fn upcast_from(value: T) -> T
fn upcast_from(value: T) -> T
Extend the current UnsignedInt to a possibly bigger size.
source§impl<T> UpcastableFrom<T> for T
impl<T> UpcastableFrom<T> for T
source§fn upcast_from(value: T) -> T
fn upcast_from(value: T) -> T
Extend the current UnsignedInt to a possibly bigger size.