• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vigna / webgraph-rs / 23365769388

20 Mar 2026 10:52PM UTC coverage: 68.228% (-3.0%) from 71.245%
23365769388

push

github

vigna
No le_bins,be_bins for webgraph

6655 of 9754 relevant lines covered (68.23%)

46582760.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cli/src/check/eq.rs
1
/*
2
 * SPDX-FileCopyrightText: 2024 Davide Cologni
3
 * SPDX-FileCopyrightText: 2026 Sebastiano Vigna
4
 *
5
 * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
6
 */
7

8
use anyhow::Result;
9
use clap::Args;
10
use dsi_bitstream::dispatch::factory::CodesReaderFactoryHelper;
11
use dsi_bitstream::prelude::*;
12
use std::{path::PathBuf, process::exit};
13
use webgraph::graphs::bvgraph::get_endianness;
14
use webgraph::traits::graph;
15
use webgraph::utils::MmapHelper;
16

17
#[derive(Args, Debug)]
18
#[command(
19
    name = "eq",
20
    about = "Checks that two graphs have the same contents, listed in the same order.",
21
    long_about = "Checks that two graphs have the same contents, listed in the same order. Useful to verify equality when two graphs are compressed with different parameters or algorithms (e.g., reference selection).",
22
    next_line_help = true
23
)]
24
pub struct CliArgs {
25
    /// The basename of the first graph.​
26
    pub first_basename: PathBuf,
27
    /// The basename of the second graph.​
28
    pub second_basename: PathBuf,
29
}
30

31
pub fn main(args: CliArgs) -> Result<()> {
×
32
    match get_endianness(&args.first_basename)?.as_str() {
×
33
        #[cfg(feature = "be_bins")]
34
        BE::NAME => compare_graphs::<BE>(args),
×
35
        #[cfg(feature = "le_bins")]
36
        LE::NAME => compare_graphs::<LE>(args),
×
37
        e => panic!("Unknown endianness: {}", e),
×
38
    }
39
}
40

41
pub fn compare_graphs<E: Endianness + 'static>(args: CliArgs) -> Result<()>
×
42
where
43
    MmapHelper<u32>: CodesReaderFactoryHelper<E>,
44
{
45
    let first_graph =
×
46
        webgraph::graphs::bvgraph::sequential::BvGraphSeq::with_basename(&args.first_basename)
×
47
            .endianness::<E>()
48
            .load()?;
49
    let second_graph =
×
50
        webgraph::graphs::bvgraph::sequential::BvGraphSeq::with_basename(&args.second_basename)
×
51
            .endianness::<E>()
52
            .load()?;
53

54
    log::info!("Comparing graphs...");
×
55
    let result = graph::eq(&first_graph, &second_graph);
×
56
    if let Err(eq_error) = result {
×
57
        eprintln!("{}", eq_error);
×
58
        exit(1);
×
59
    }
60
    log::info!("Graphs are equal.");
×
61

62
    Ok(())
×
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc