Skip to content

Commit 4827b16

Browse files
committed
More missing docs
1 parent 58cdf04 commit 4827b16

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

algo/src/sccs/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ pub struct Sccs<C: AsRef<[usize]> = Box<[usize]>> {
6868
}
6969

7070
impl<C: AsRef<[usize]>> Sccs<C> {
71+
/// Creates a new instance from the number of components and the
72+
/// component assignment for each node.
7173
pub fn new(num_components: usize, components: C) -> Self {
7274
Sccs {
7375
num_components,

webgraph/src/graphs/csr_graph.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@ use value_traits::{
1616
slices::SliceByValue,
1717
};
1818

19+
/// A [`CsrGraph`] with Elias–Fano-encoded degree cumulative function and
20+
/// [`BitFieldVec`]-encoded successors.
1921
pub type CompressedCsrGraph = CsrGraph<EF, BitFieldVec>;
22+
23+
/// A [`CsrSortedGraph`] with Elias–Fano-encoded degree cumulative function and
24+
/// [`BitFieldVec`]-encoded successors.
2025
pub type CompressedCsrSortedGraph = CsrSortedGraph<EF, BitFieldVec>;
2126

2227
/// A compressed sparse-row graph.
2328
#[derive(Debug, Clone, Epserde)]
2429
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2530
///
26-
/// It is a graph representation that stores the degree-cumulative function
31+
/// It is a graph representation that stores the degree cumulative function
2732
/// (DCF) and the successors in a compressed format. The DCF is a sequence of
2833
/// offsets that indicates the start of the neighbors for each node in the
2934
/// graph. Building a CSR graph requires always a sorted lender.
@@ -54,26 +59,30 @@ pub struct CsrGraph<DCF = Box<[usize]>, S = Box<[usize]>> {
5459
pub struct CsrSortedGraph<DCF = Box<[usize]>, S = Box<[usize]>>(CsrGraph<DCF, S>);
5560

5661
impl<DCF, S> CsrGraph<DCF, S> {
57-
/// Creates a new CSR graph from the given degree-cumulative function and
62+
/// Creates a new CSR graph from the given degree cumulative function and
5863
/// successors.
5964
///
6065
/// # Safety
61-
/// The degree-cumulative function must be monotone and coherent with the
66+
/// The degree cumulative function must be monotone and coherent with the
6267
/// successors.
6368
pub unsafe fn from_parts(dcf: DCF, successors: S) -> Self {
6469
Self { dcf, successors }
6570
}
6671

72+
/// Returns a reference to the degree cumulative function.
6773
#[inline(always)]
6874
pub fn dcf(&self) -> &DCF {
6975
&self.dcf
7076
}
7177

78+
/// Returns a reference to the successors.
7279
#[inline(always)]
7380
pub fn successors(&self) -> &S {
7481
&self.successors
7582
}
7683

84+
/// Consumes the graph, returning the degree cumulative function and
85+
/// the successors.
7786
#[inline(always)]
7887
pub fn into_inner(self) -> (DCF, S) {
7988
(self.dcf, self.successors)

webgraph/src/graphs/permuted_graph.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ use value_traits::slices::SliceByValue;
1616
/// on the graph nor the successors are sorted.
1717
#[derive(Debug, Clone)]
1818
pub struct PermutedGraph<'a, G: SequentialGraph, P: SliceByValue<Value = usize> + ?Sized> {
19+
/// The underlying graph.
1920
pub graph: &'a G,
21+
/// The permutation to apply: node *i* of the permuted graph
22+
/// corresponds to node `perm[`*i*`]` of the underlying graph.
2023
pub perm: &'a P,
2124
}
2225

webgraph/src/graphs/vec_graph.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use lender::prelude::*;
1212
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1313
#[derive(Epserde, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
1414
#[epserde_deep_copy]
15+
/// An arc with a label, stored as a pair (target, label).
1516
pub struct LabeledArc<L>(usize, L);
1617

1718
impl<L> From<(usize, L)> for LabeledArc<L> {

0 commit comments

Comments
 (0)