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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use crate::hg_gen_algorithms::*;
use crate::hg_formats::*;
use crate::hg_utils::*;
pub fn hg_hyperbolic_distance(
gtype: HgGraphType,
node1: &HgCoordinateType,
node2: &HgCoordinateType,
zeta_eta: f64) -> f64 {
if (node1.r == node2.r) && (node1.theta == node2.theta) {
return 0.0;
}
match gtype {
HgGraphType::HyperbolicRgg | HgGraphType::HyperbolicStandard =>
hg_hyperbolic_distance_hyperbolic_rgg_standard(zeta_eta, node1, node2),
HgGraphType::SoftConfigurationModel =>
hg_hyperbolic_distance_scm(node1, node2),
HgGraphType::AngularRgg | HgGraphType::SoftRgg =>
hg_hyperbolic_distance_angular_soft_rgg(node1, node2),
HgGraphType::ErdosRenyi =>
hg_hyperbolic_distance_er(node1, node2)
}
}
pub fn hg_graph_generator(
n: usize,
k_bar: f64,
exp_gamma: f64,
t : f64,
zeta: f64,
seed: u32) -> Result<Graph, &'static str> {
rgsl::RngType::env_setup();
let rnd_type = rgsl::rng::algorithms::mt19937();
let mut rnd = rgsl::Rng::new(&rnd_type).unwrap();
rnd.set(seed as usize);
let mut rnd_01 = || { rnd.uniform() };
let gt = hg_infer_hg_type(exp_gamma, t);
match gt {
HgGraphType::HyperbolicRgg =>
hg_hyperbolic_rgg(n, &mut rnd_01, k_bar, exp_gamma, zeta),
HgGraphType::HyperbolicStandard =>
hg_hyperbolic_standard(n, &mut rnd_01, k_bar, exp_gamma, t, zeta),
HgGraphType::SoftConfigurationModel =>
hg_soft_configuration_model(n, &mut rnd_01, k_bar, exp_gamma, zeta),
HgGraphType::AngularRgg =>
hg_angular_rgg(n, &mut rnd_01, k_bar, zeta),
HgGraphType::SoftRgg =>
hg_soft_rgg(n, &mut rnd_01, k_bar, t, zeta),
HgGraphType::ErdosRenyi =>
hg_erdos_renyi(n, &mut rnd_01, k_bar, zeta),
}
}