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
32use graphid::usize_to_f64_exact;
33#[cfg(test)]
34use graphid::{MAX_GRAPHID_LABEL_ID, MAX_GRAPHID_SEQUENCE};
35use partition::Partition;
36
37#[derive(Debug, Default, Clone)]
38pub struct MemoryGraphStore {
39 vertices: BTreeMap<VertexId, Vertex>,
40 edges: BTreeMap<EdgeId, Edge>,
41 graphs: BTreeMap<String, Partition>,
42 vertex_membership: BTreeMap<VertexId, BTreeSet<String>>,
43 edge_membership: BTreeMap<EdgeId, BTreeSet<String>>,
44 label_registries: BTreeMap<String, GraphLabelRegistry>,
45 next_vertex_id: VertexId,
46 next_edge_id: EdgeId,
47}
48
49#[cfg(test)]
50mod tests;