uqa_graph/
memory_store.rs1use std::collections::{BTreeMap, BTreeSet};
14
15use serde::{Deserialize, Serialize};
16use uqa_core::{Edge, EdgeId, Vertex, VertexId};
17
18use crate::store::{GraphStore, GraphStoreError, GraphStoreResult};
19use crate::types::Direction;
20
21mod graphid;
22mod partition;
23mod store;
24mod trait_impl;
25
26pub use graphid::{
27 graphid_label_id, graphid_sequence, make_graphid, GraphLabelInfo, GraphLabelRegistry,
28 LabelKind, EDGE_DEFAULT_LABEL_ID, FIRST_USER_LABEL_ID, GRAPHID_LABEL_SHIFT,
29 VERTEX_DEFAULT_LABEL_ID,
30};
31
32pub(crate) use graphid::{usize_to_f64_exact, MAX_GRAPHID_LABEL_ID, MAX_GRAPHID_SEQUENCE};
33use partition::Partition;
34
35#[derive(Debug, Default, Clone)]
36pub struct MemoryGraphStore {
37 vertices: BTreeMap<VertexId, Vertex>,
38 edges: BTreeMap<EdgeId, Edge>,
39 graphs: BTreeMap<String, Partition>,
40 vertex_membership: BTreeMap<VertexId, BTreeSet<String>>,
41 edge_membership: BTreeMap<EdgeId, BTreeSet<String>>,
42 label_registries: BTreeMap<String, GraphLabelRegistry>,
43 next_vertex_id: VertexId,
44 next_edge_id: EdgeId,
45}
46
47#[cfg(test)]
48mod tests;