1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use crate::algorithms::randgen::TrSelector;

/// Configuration struct for random path generation.
pub struct RandGenConfig<S: TrSelector> {
    /// How an arc is selected at a state.
    pub selector: S,
    /// Maximum path length.
    pub max_length: usize,
    /// Number of paths to generate.
    pub npath: usize,
    ///Is the output tree weighted by path count, or is it just an unweighted DAG?
    pub weighted: bool,
    /// Remove total weight when output is weighted?
    pub remove_total_weight: bool,
}

impl<S: TrSelector> RandGenConfig<S> {
    pub fn new(selector: S) -> Self {
        Self {
            selector,
            max_length: usize::MAX,
            npath: 1,
            weighted: false,
            remove_total_weight: false,
        }
    }

    pub fn with_max_length(self, max_length: usize) -> Self {
        Self { max_length, ..self }
    }

    pub fn with_npath(self, npath: usize) -> Self {
        Self { npath, ..self }
    }

    pub fn with_weighted(self, weighted: bool) -> Self {
        Self { weighted, ..self }
    }

    pub fn with_remove_total_weight(self, remove_total_weight: bool) -> Self {
        Self {
            remove_total_weight,
            ..self
        }
    }
}