webgraph_cli/run/
llp_combine.rs1use crate::{GlobalArgs, NumThreadsArg, get_thread_pool};
10use anyhow::Result;
11use clap::Parser;
12use webgraph_algo::{combine_labels, labels_to_ranks};
13
14use std::path::PathBuf;
15
16use super::llp::store_perm;
17
18#[derive(Parser, Debug)]
19#[command(name = "llp-combine", about = "Combine the pre-compute labels from Layered Label Propagation into permutation.", long_about = None)]
20pub struct CliArgs {
21 pub work_dir: PathBuf,
23
24 pub perm: PathBuf,
26
27 #[arg(short, long)]
28 pub epserde: bool,
30
31 #[command(flatten)]
33 pub num_threads: NumThreadsArg,
34}
35
36pub fn main(_global_args: GlobalArgs, args: CliArgs) -> Result<()> {
37 let thread_pool = get_thread_pool(args.num_threads.num_threads);
38 thread_pool.install(|| -> Result<()> {
39 let labels = combine_labels(args.work_dir)?;
40 log::info!("Combined labels...");
41 let rank_perm = labels_to_ranks(&labels);
42 log::info!("Saving permutation...");
43 store_perm(&rank_perm, &args.perm, args.epserde)?;
44 Ok(())
45 })
46}