Trait swh_graph::graph::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
isZip<L, R>
, this defers toL
(aka.Left<Zip<L, R>
). - If
Self
isVecGraph<_>
, this does the equivalent of deferring toVecGraph<()>
(throughDelabelingIterator
because it cannot create a newVecGraph
without copying)
Required Associated Types§
type UnlabeledSuccessors<'succ>: IntoIterator<Item = NodeId> where Self: 'succ
Required Methods§
sourcefn num_arcs(&self) -> u64
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 SwhLabels::num_arcs
always panics as of
f460742fe0f776df2248a5f09a3425b81eb70b07, so we can’t use that.
fn has_arc(&self, src_node_id: NodeId, dst_node_id: NodeId) -> bool
fn unlabeled_successors(&self, node_id: NodeId) -> Self::UnlabeledSuccessors<'_>
Object Safety§
This trait is not object safe.