Skip to content

Commit e9d5dfe

Browse files
committed
Merge branch 'docbrownv4_merge' of github.com:Pometry/Raphtory into vacuum
2 parents c13f506 + 052bf88 commit e9d5dfe

File tree

6 files changed

+34
-19
lines changed

6 files changed

+34
-19
lines changed

raphtory-benchmark/benches/edge_add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use criterion::{criterion_group, criterion_main, Criterion};
22
use rand::{
3-
distributions::{Alphanumeric, DistString},
3+
distr::{Alphanumeric, SampleString},
44
rng, Rng,
55
};
66
use raphtory::prelude::*;

raphtory-benchmark/benches/tgraph_benchmarks.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
2-
use rand::{distributions::Uniform, Rng};
2+
use rand::{distr::Uniform, Rng};
33
use raphtory::core::entities::nodes::structure::adjset::AdjSet;
44
use sorted_vector_map::SortedVectorSet;
55
use std::collections::BTreeSet;
@@ -10,7 +10,7 @@ fn btree_set_u64(c: &mut Criterion) {
1010
group.throughput(Throughput::Elements(*size as u64));
1111

1212
let mut rng = rand::rng();
13-
let range = Uniform::new(u64::MIN, u64::MAX);
13+
let range = Uniform::new(u64::MIN, u64::MAX).unwrap();
1414
let init_vals: Vec<u64> = (&mut rng).sample_iter(&range).take(*size).collect();
1515

1616
group.bench_with_input(
@@ -50,7 +50,8 @@ fn bm_tadjset(c: &mut Criterion) {
5050
group.throughput(Throughput::Elements(*size as u64));
5151

5252
let mut rng = rand::rng();
53-
let range = Uniform::new(0, size * 10);
53+
let range = Uniform::new(0, size * 10).unwrap();
54+
5455
let init_srcs: Vec<usize> = (&mut rng)
5556
.sample_iter(&range)
5657
.take(*size as usize)
@@ -59,7 +60,7 @@ fn bm_tadjset(c: &mut Criterion) {
5960
.sample_iter(&range)
6061
.take(*size as usize)
6162
.collect();
62-
let t_range = Uniform::new(1646838523i64, 1678374523);
63+
let t_range = Uniform::new(1646838523i64, 1678374523).unwrap();
6364
let init_time: Vec<i64> = (&mut rng)
6465
.sample_iter(&t_range)
6566
.take(*size as usize)

raphtory-benchmark/src/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use criterion::{
88
use rand::{distr::Uniform, seq::*, Rng, SeedableRng};
99
use raphtory::{db::api::view::StaticGraphViewOps, prelude::*};
1010
use raphtory_api::core::utils::logging::global_info_logger;
11-
use std::{collections::HashSet, path::PathBuf};
11+
use std::collections::HashSet;
1212
use tempfile::TempDir;
1313
use tracing::info;
1414

raphtory/src/algorithms/dynamics/temporal/epidemics.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ use crate::{
1010
prelude::*,
1111
};
1212
use indexmap::IndexSet;
13-
use rand::{distr::Bernoulli, seq::IteratorRandom, Rng};
14-
use rand_distr::{Distribution, Exp};
13+
use rand::{
14+
distr::{Bernoulli, Distribution},
15+
seq::IteratorRandom,
16+
Rng,
17+
};
18+
use rand_distr::Exp;
1519
use raphtory_core::utils::time::ParseTimeError;
1620
use std::{
1721
cmp::Reverse,
@@ -258,8 +262,8 @@ mod test {
258262
algorithms::dynamics::temporal::epidemics::{temporal_SEIR, Number},
259263
prelude::*,
260264
};
261-
use rand::{rngs::SmallRng, Rng, SeedableRng};
262-
use rand_distr::{Distribution, Exp};
265+
use rand::{distr::Distribution, rngs::SmallRng, Rng, SeedableRng};
266+
use rand_distr::Exp;
263267
use raphtory_api::core::utils::logging::global_info_logger;
264268
use rayon::prelude::*;
265269
use stats::{mean, stddev};

raphtory/src/db/api/state/node_state_ord_ops.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,16 @@ where
434434
mod test {
435435
use crate::db::api::state::node_state_ord_ops::{par_top_k, top_k};
436436

437-
use rand; // 0.8.5
438-
439-
use rand::distr::{Distribution, Uniform};
437+
use rand::{
438+
distr::{Distribution, Uniform},
439+
Rng,
440+
};
440441
use tokio::time::Instant;
441442

442443
fn gen_x_ints(
443444
count: u32,
444445
distribution: impl Distribution<u32>,
445-
rng: &mut (impl rand::Rng + ?Sized),
446+
rng: &mut (impl Rng + ?Sized),
446447
) -> Vec<u32> {
447448
let mut results = Vec::with_capacity(count as usize);
448449
let iter = distribution.sample_iter(rng);

raphtory/src/serialise/graph_folder.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
db::api::view::MaterializedGraph,
33
errors::GraphError,
4-
prelude::{GraphViewOps, PropertiesOps},
4+
prelude::{Graph, GraphViewOps, PropertiesOps},
55
serialise::{metadata::GraphMetadata, serialise::StableDecode},
66
};
77
use std::{
@@ -122,9 +122,20 @@ impl GraphFolder {
122122
"Metadata file does not exist or is invalid. Attempting to recreate..."
123123
);
124124

125-
let graph: MaterializedGraph = MaterializedGraph::decode(self, None)?;
125+
// Either decode a graph serialized using encode or load using underlying storage.
126+
let graph = if MaterializedGraph::is_decodable(self.get_graph_path()) {
127+
MaterializedGraph::decode(self, None)?
128+
} else {
129+
// We currently do not have a way of figuring out the graph type
130+
// from storage, so for now default to an EventGraph.
131+
let graph = Graph::load_from_path(self.get_graph_path());
132+
MaterializedGraph::EventGraph(graph)
133+
};
126134

127135
self.write_metadata(&graph)?;
136+
137+
info!("Metadata file recreated successfully");
138+
128139
Ok(self.try_read_metadata()?)
129140
}
130141
_ => Err(e.into()),
@@ -296,10 +307,8 @@ impl From<&GraphFolder> for GraphFolder {
296307
}
297308
}
298309

299-
// this mod focuses on the zip format, as the folder format is
300-
// the default and is largely exercised in other places
301310
#[cfg(test)]
302-
mod zip_tests {
311+
mod tests {
303312
use super::*;
304313
use crate::{
305314
db::graph::graph::assert_graph_equal,

0 commit comments

Comments
 (0)