swh_graph::graph

Trait UnderlyingGraph

Source
pub trait UnderlyingGraph: RandomAccessLabeling {
    type UnlabeledSuccessors<'succ>: IntoIterator<Item = NodeId>
       where Self: 'succ;

    // Required methods
    fn num_arcs(&self) -> u64;
    fn has_arc(&self, src_node_id: NodeId, dst_node_id: NodeId) -> bool;
    fn unlabeled_successors(
        &self,
        node_id: NodeId,
    ) -> Self::UnlabeledSuccessors<'_>;
}
Expand description

Supertrait of RandomAccessLabeling with methods to act like a RandomAccessGraph.

If Self implements RandomAccessGraph, then this is implemented as no-ops. Otherwise, it “unpeels” layers of zipping until it reaches the graph at the bottom:

  • If Self is Zip<L, R>, this defers to L (aka. Left<Zip<L, R>).
  • If Self is VecGraph<_>, this does the equivalent of deferring to VecGraph<()> (through DelabelingIterator because it cannot create a new VecGraph without copying)

Required Associated Types§

Source

type UnlabeledSuccessors<'succ>: IntoIterator<Item = NodeId> where Self: 'succ

Required Methods§

Source

fn num_arcs(&self) -> u64

Workaround for some implementations of <Self as RandomAccessLabeling>::num_arcs being missing

Zip::num_arcs runs assert_eq!(self.0.num_arcs(), self.1.num_arcs()); but BitStreamLabeling::num_arcs always panics as of f460742fe0f776df2248a5f09a3425b81eb70b07, so we can’t use that.

Source

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

Source

fn unlabeled_successors(&self, node_id: NodeId) -> Self::UnlabeledSuccessors<'_>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<F: RandomAccessDecoderFactory> UnderlyingGraph for BvGraph<F>

Source§

type UnlabeledSuccessors<'succ> = <BvGraph<F> as RandomAccessLabeling>::Labels<'succ> where Self: 'succ

Source§

fn num_arcs(&self) -> u64

Source§

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

Source§

fn unlabeled_successors(&self, node_id: NodeId) -> Self::UnlabeledSuccessors<'_>

Source§

impl<G: UnderlyingGraph, L: RandomAccessLabeling> UnderlyingGraph for Zip<G, L>

Source§

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

Source§

fn num_arcs(&self) -> u64

Source§

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

Source§

fn unlabeled_successors(&self, node_id: NodeId) -> Self::UnlabeledSuccessors<'_>

Source§

impl<L: Copy> UnderlyingGraph for VecGraph<L>

Source§

type UnlabeledSuccessors<'succ> = DelabelingIterator<<VecGraph<L> as RandomAccessLabeling>::Labels<'succ>> where Self: 'succ

Source§

fn num_arcs(&self) -> u64

Source§

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

Source§

fn unlabeled_successors(&self, node_id: NodeId) -> Self::UnlabeledSuccessors<'_>

Source§

impl<L: Copy> UnderlyingGraph for Left<VecGraph<L>>

Source§

type UnlabeledSuccessors<'succ> = <Left<VecGraph<L>> as RandomAccessLabeling>::Labels<'succ> where Self: 'succ

Source§

fn num_arcs(&self) -> u64

Source§

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

Source§

fn unlabeled_successors(&self, node_id: NodeId) -> Self::UnlabeledSuccessors<'_>

Implementors§