Skip to content

Commit

Permalink
rename graph props to graph meta (#1501)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamka1 authored Feb 23, 2024
1 parent 802e6e2 commit c65dc6a
Show file tree
Hide file tree
Showing 11 changed files with 444 additions and 333 deletions.
717 changes: 414 additions & 303 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions raphtory/src/core/entities/graph/tgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
node_store::NodeStore,
},
properties::{
graph_props::GraphProps,
graph_meta::GraphMeta,
props::{ArcReadLockedVec, Meta},
tprop::TProp,
},
Expand Down Expand Up @@ -93,7 +93,7 @@ pub struct TemporalGraph<const N: usize> {
pub(crate) edge_meta: Arc<Meta>,

// graph properties
pub(crate) graph_props: GraphProps,
pub(crate) graph_meta: GraphMeta,
}

impl<const N: usize> std::fmt::Display for InnerTemporalGraph<N> {
Expand All @@ -118,7 +118,7 @@ impl<const N: usize> Default for InnerTemporalGraph<N> {
latest_time: MaxCounter::new(),
node_meta: Arc::new(Meta::new()),
edge_meta: Arc::new(Meta::new()),
graph_props: GraphProps::new(),
graph_meta: GraphMeta::new(),
};

Self(Arc::new(tg))
Expand Down Expand Up @@ -436,7 +436,7 @@ impl<const N: usize> TemporalGraph<N> {
props: Vec<(usize, Prop)>,
) -> Result<(), GraphError> {
for (id, prop) in props {
self.graph_props.add_constant_prop(id, prop)?;
self.graph_meta.add_constant_prop(id, prop)?;
}
Ok(())
}
Expand All @@ -446,7 +446,7 @@ impl<const N: usize> TemporalGraph<N> {
props: Vec<(usize, Prop)>,
) -> Result<(), GraphError> {
for (id, prop) in props {
self.graph_props.update_constant_prop(id, prop)?;
self.graph_meta.update_constant_prop(id, prop)?;
}
Ok(())
}
Expand All @@ -457,25 +457,25 @@ impl<const N: usize> TemporalGraph<N> {
props: Vec<(usize, Prop)>,
) -> Result<(), GraphError> {
for (prop_id, prop) in props {
self.graph_props.add_prop(t, prop_id, prop)?;
self.graph_meta.add_prop(t, prop_id, prop)?;
}
Ok(())
}

pub(crate) fn get_constant_prop(&self, id: usize) -> Option<Prop> {
self.graph_props.get_constant(id)
self.graph_meta.get_constant(id)
}

pub(crate) fn get_temporal_prop(&self, id: usize) -> Option<LockedView<TProp>> {
self.graph_props.get_temporal_prop(id)
self.graph_meta.get_temporal_prop(id)
}

pub(crate) fn const_prop_names(&self) -> ArcReadLockedVec<ArcStr> {
self.graph_props.constant_names()
self.graph_meta.constant_names()
}

pub(crate) fn temporal_property_names(&self) -> ArcReadLockedVec<ArcStr> {
self.graph_props.temporal_names()
self.graph_meta.temporal_names()
}

pub(crate) fn delete_edge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ use std::{
};

#[derive(Serialize, Deserialize, Debug)]
pub struct GraphProps {
pub struct GraphMeta {
constant_mapper: DictMapper,
temporal_mapper: DictMapper,
constant: FxDashMap<usize, Option<Prop>>,
temporal: FxDashMap<usize, TProp>,
}

impl GraphProps {
impl GraphMeta {
pub(crate) fn new() -> Self {
Self {
constant_mapper: DictMapper::default(),
Expand Down
2 changes: 1 addition & 1 deletion raphtory/src/core/entities/properties/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod graph_props;
pub mod graph_meta;
pub mod props;
pub mod tcell;
pub mod tprop;
6 changes: 3 additions & 3 deletions raphtory/src/db/api/view/internal/core_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
edges::{edge_ref::EdgeRef, edge_store::EdgeStore},
nodes::{node_ref::NodeRef, node_store::NodeStore},
properties::{
graph_props::GraphProps,
graph_meta::GraphMeta,
props::Meta,
tprop::{LockedLayeredTProp, TProp},
},
Expand All @@ -31,7 +31,7 @@ pub trait CoreGraphOps {

fn edge_meta(&self) -> &Meta;

fn graph_meta(&self) -> &GraphProps;
fn graph_meta(&self) -> &GraphMeta;

fn get_layer_name(&self, layer_id: usize) -> ArcStr;

Expand Down Expand Up @@ -244,7 +244,7 @@ impl<G: DelegateCoreOps + ?Sized> CoreGraphOps for G {
}

#[inline]
fn graph_meta(&self) -> &GraphProps {
fn graph_meta(&self) -> &GraphMeta {
self.graph().graph_meta()
}

Expand Down
2 changes: 1 addition & 1 deletion raphtory/src/db/api/view/internal/materialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
edges::{edge_ref::EdgeRef, edge_store::EdgeStore},
nodes::{node_ref::NodeRef, node_store::NodeStore},
properties::{
graph_props::GraphProps,
graph_meta::GraphMeta,
props::Meta,
tprop::{LockedLayeredTProp, TProp},
},
Expand Down
2 changes: 1 addition & 1 deletion raphtory/src/db/internal/addition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<const N: usize> InternalAdditionOps for InnerTemporalGraph<N> {

#[inline]
fn resolve_graph_property(&self, prop: &str, is_static: bool) -> usize {
self.inner().graph_props.resolve_property(prop, is_static)
self.inner().graph_meta.resolve_property(prop, is_static)
}

#[inline]
Expand Down
6 changes: 3 additions & 3 deletions raphtory/src/db/internal/core_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
graph::tgraph::InnerTemporalGraph,
nodes::{node_ref::NodeRef, node_store::NodeStore},
properties::{
graph_props::GraphProps,
graph_meta::GraphMeta,
props::Meta,
tprop::{LockedLayeredTProp, TProp},
},
Expand Down Expand Up @@ -41,8 +41,8 @@ impl<const N: usize> CoreGraphOps for InnerTemporalGraph<N> {
}

#[inline]
fn graph_meta(&self) -> &GraphProps {
&self.inner().graph_props
fn graph_meta(&self) -> &GraphMeta {
&self.inner().graph_meta
}

#[inline]
Expand Down
6 changes: 3 additions & 3 deletions raphtory/src/db/internal/static_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use crate::{

impl<const N: usize> ConstPropertiesOps for InnerTemporalGraph<N> {
fn get_const_prop_id(&self, name: &str) -> Option<usize> {
self.inner().graph_props.get_const_prop_id(name)
self.inner().graph_meta.get_const_prop_id(name)
}

fn get_const_prop_name(&self, id: usize) -> ArcStr {
self.inner().graph_props.get_const_prop_name(id)
self.inner().graph_meta.get_const_prop_name(id)
}

fn const_prop_ids(&self) -> Box<dyn Iterator<Item = usize>> {
Box::new(self.inner().graph_props.const_prop_ids())
Box::new(self.inner().graph_meta.const_prop_ids())
}

fn const_prop_keys(&self) -> Box<dyn Iterator<Item = ArcStr>> {
Expand Down
8 changes: 4 additions & 4 deletions raphtory/src/db/internal/temporal_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ impl<const N: usize> TemporalPropertyViewOps for InnerTemporalGraph<N> {

impl<const N: usize> TemporalPropertiesOps for InnerTemporalGraph<N> {
fn get_temporal_prop_id(&self, name: &str) -> Option<usize> {
self.inner().graph_props.get_temporal_id(name)
self.inner().graph_meta.get_temporal_id(name)
}

fn get_temporal_prop_name(&self, id: usize) -> ArcStr {
self.inner().graph_props.get_temporal_name(id)
self.inner().graph_meta.get_temporal_name(id)
}

fn temporal_prop_ids(&self) -> Box<dyn Iterator<Item = usize> + '_> {
Box::new(self.inner().graph_props.temporal_ids())
Box::new(self.inner().graph_meta.temporal_ids())
}

fn temporal_prop_keys(&self) -> Box<dyn Iterator<Item = ArcStr> + '_> {
Box::new(self.inner().graph_props.temporal_names().into_iter())
Box::new(self.inner().graph_meta.temporal_names().into_iter())
}
}
4 changes: 2 additions & 2 deletions raphtory/src/db/internal/time_semantics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl<const N: usize> TimeSemantics for InnerTemporalGraph<N> {
}

fn has_temporal_prop(&self, prop_id: usize) -> bool {
prop_id < self.inner().graph_props.temporal_prop_meta().len()
prop_id < self.inner().graph_meta.temporal_prop_meta().len()
}

fn temporal_prop_vec(&self, prop_id: usize) -> Vec<(i64, Prop)> {
Expand All @@ -252,7 +252,7 @@ impl<const N: usize> TimeSemantics for InnerTemporalGraph<N> {

fn has_temporal_prop_window(&self, prop_id: usize, w: Range<i64>) -> bool {
self.inner()
.graph_props
.graph_meta
.get_temporal_prop(prop_id)
.filter(|p| p.iter_window_t(w).next().is_some())
.is_some()
Expand Down

0 comments on commit c65dc6a

Please sign in to comment.