Skip to content

Commit 6b23067

Browse files
committed
Minor improvements
1 parent 20aa4a0 commit 6b23067

13 files changed

Lines changed: 46 additions & 14 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ framework](https://webgraph.di.unimi.it/) for graph compression.
1111
- Compressed graph representation (start from here):
1212
[`webgraph`](https://crates.io/crates/webgraph) ([repo](/webgraph))
1313

14-
- Algorithms: [`webgraph-algo`](https://crates.io/crates/webgraph_algo)
14+
- Algorithms: [`webgraph-algo`](https://crates.io/crates/webgraph-algo)
1515
([repo](/algo))
1616

17-
- CLI commands: [`webgraph-cli`](https://crates.io/crates/webgraph_cli)
17+
- CLI commands: [`webgraph-cli`](https://crates.io/crates/webgraph-cli)
1818
([repo](/cli))
1919

2020
## Acknowledgments

algo/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ compression.
3333
- **[Layered Label Propagation]** (LLP): Fast community detection algorithm for
3434
large graphs
3535

36+
### Ranking
37+
38+
- **[PageRank]**: Fast parallel computation of PageRank.
39+
3640
## CLI Integration
3741

3842
Many algorithms can also be accessed through the [command-line interface].
@@ -58,3 +62,4 @@ Union nor the Italian MUR can be held responsible for them.
5862
[Layered Label Propagation]: https://docs.rs/webgraph-algo/latest/webgraph_algo/llp/index.html
5963
[command-line interface]: https://docs.rs/webgraph-cli/latest/index.html
6064
[WebGraph framework]: https://webgraph.di.unimi.it/
65+
[PageRank]: https://docs.rs/webgraph-algo/latest/webgraph_algo/rank/pagerank/index.html

algo/src/llp/preds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use std::fmt::Display;
3333
#[doc(hidden)]
3434
/// This structure is passed to stopping predicates to provide the information
3535
/// that is needed to evaluate them.
36+
#[derive(Debug)]
3637
pub struct PredParams {
3738
pub num_nodes: usize,
3839
pub num_arcs: u64,

algo/src/rank/pagerank.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ pub mod preds {
164164
#[doc(hidden)]
165165
/// This structure is passed to stopping predicates to provide the
166166
/// information that is needed to evaluate them.
167+
#[derive(Debug)]
167168
pub struct PredParams {
168169
pub iteration: usize,
169170
pub norm_delta: f64,
@@ -372,6 +373,18 @@ pub struct PageRank<'a, G: RandomAccessGraph + Sync> {
372373
iteration: usize,
373374
}
374375

376+
impl<G: RandomAccessGraph + Sync> std::fmt::Debug for PageRank<'_, G> {
377+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
378+
f.debug_struct("PageRank")
379+
.field("alpha", &self.alpha)
380+
.field("mode", &self.mode)
381+
.field("granularity", &self.granularity)
382+
.field("norm_delta", &self.norm_delta)
383+
.field("iteration", &self.iteration)
384+
.finish_non_exhaustive()
385+
}
386+
}
387+
375388
impl<'a, G: RandomAccessGraph + Sync> PageRank<'a, G> {
376389
/// Creates a new PageRank computation.
377390
///

cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ implemented as a submodule.
3030
- `build`: builds accessory graph data structures;
3131
- `check`: checks coherence of graph files;
3232
- `from`: ingests data into graphs;
33-
- `perm`: creates and manipulate permutations;
33+
- `perm`: creates and manipulates permutations;
3434
- `run`: runs algorithms on graph;
3535
- `to`: converts graphs between representations;
3636
- `transform`: applies transformations to graphs.

cli/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ build info: built on {} for {} with {}",
6767
///
6868
/// It is used to implement [`ValueEnum`] here instead of in [`dsi_bitstream`].
6969
///
70-
/// For CLI ergonomics and compatibility, this codes must be the same as those
70+
/// For CLI ergonomics and compatibility, these codes must be the same as those
7171
/// appearing in [`CompFlags::code_from_str`].
7272
pub enum PrivCode {
7373
Unary,
@@ -523,7 +523,7 @@ impl IntVectorFormat {
523523
/// be computed from the data.
524524
///
525525
/// This helper method is available only on 64-bit architectures as Java's format
526-
/// uses of 64-bit integers.
526+
/// uses 64-bit integers.
527527
pub fn store_usizes(
528528
&self,
529529
path: impl AsRef<Path>,

webgraph/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bitstream containing pointers into the graph bitstream).
7272

7373
As a first step, if you need random access to the successors of a node, you need
7474
to build an [Elias–Fano] representation of the offsets (this part can be skipped
75-
if you just need sequential access). There is a [CLI command `webgraph`] with many
75+
if you just need sequential access). There is a [command-line interface] with many
7676
subcommands, among which `build`, and `webgraph build ef BASENAME` will build
7777
the representation for you, serializing it with [ε-serde] in a file
7878
named `BASENAME.ef`.
@@ -160,7 +160,7 @@ very large graphs, the mapping might not fit in RAM. For example,
160160
```bash
161161
echo -e "a\tb\nb\tc\nc\ta" > graph.tsv
162162
# convert to bvgraph
163-
cat graph.tsv | cargo run --release from arcs --label graph
163+
cat graph.tsv | cargo run --release from arcs --labels graph
164164
```
165165

166166
The graph can be converted back in the arcs format using the `to arcs` command.
@@ -206,7 +206,7 @@ Union nor the Italian MUR can be held responsible for them.
206206
[iteration]: https://docs.rs/webgraph/latest/webgraph/traits/labels/trait.SequentialLabeling.html#method.iter
207207
[retrieve the successors of a node]: https://docs.rs/webgraph/latest/webgraph/traits/graph/trait.RandomAccessGraph.html#method.successors
208208
[LAW web site]: http://law.di.unimi.it/
209-
[Elias–Fano]: sux::dict::EliasFano
209+
[Elias–Fano]: https://docs.rs/sux/latest/sux/dict/elias_fano/struct.EliasFano.html
210210
[WebGraph framework]: https://webgraph.di.unimi.it/
211211
[ε-serde]: https://crates.io/crates/epserde/
212212
[`for_`]: https://docs.rs/lender/latest/lender/macro.for_.html

webgraph/src/graphs/bvgraph/comp/bvcompz.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use lender::prelude::*;
1717

1818
/// An Entry for the table used to save the intermediate computation
1919
/// of the dynamic algorithm to select the best references.
20-
/// It represents if a reference to a node, with a know amount of previous
21-
/// references chain length, is chosen and how much less it costs to all his
22-
/// referent with respect to compress the node without any selected reference.
20+
/// It represents if a reference to a node, with a known amount of previous
21+
/// references chain length, is chosen and how much less it costs to all its
22+
/// referents with respect to compress the node without any selected reference.
2323
#[derive(Default, Clone)]
2424
struct ReferenceTableEntry {
2525
saved_cost: f32,

webgraph/src/graphs/random/er.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ impl<'succ> Lending<'succ> for NodeLabels {
8787
type Lend = (usize, <Self as NodeLabelsLender<'succ>>::IntoIterator);
8888
}
8989

90+
#[derive(Debug)]
9091
pub struct IntoSucc(Vec<usize>);
92+
#[derive(Debug)]
9193
pub struct Succ(IntoIter<usize>);
9294

9395
impl Iterator for Succ {

webgraph/src/traits/graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ as successors. Analogously, a [random-access graph](RandomAccessGraph) is simply
1616
[`RandomAccessLabeling`] extending a [`SequentialLabeling`] whose [`Label`](SequentialLabeling::Label) is `usize`.
1717
To access the successors of a node, however, you must use
1818
[`RandomAccessGraph::successors`], which delegates to [`labels`](RandomAccessLabeling::labels):
19-
the latter method is overridden on purpose make its usage on graphs impossible.
19+
the latter method is overridden on purpose to make its usage on graphs impossible.
2020
2121
In the same vein, a [sequential graph with labels](LabeledSequentialGraph) of type `L` is a
2222
[`SequentialLabeling`] whose [`Label`](SequentialLabeling::Label) is `(usize, L)`
2323
and a [random-access graph with labels](LabeledRandomAccessGraph) is a
2424
[`RandomAccessLabeling`] extending a [`SequentialLabeling`] whose [`Label`](SequentialLabeling::Label) is `(usize, L)`.
25-
Also in this case, access the successors of a node and their labels, you must use
25+
Also in this case, to access the successors of a node and their labels, you must use
2626
[`LabeledRandomAccessGraph::successors`].
2727
2828
Finally, the [zipping of a graph and a labeling](Zip) implements the

0 commit comments

Comments
 (0)