-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move minimal structs into raphtory-api
- Loading branch information
1 parent
0fc1fe2
commit 85f3869
Showing
33 changed files
with
861 additions
and
309 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "raphtory-api" | ||
version.workspace = true | ||
documentation.workspace = true | ||
repository.workspace = true | ||
license.workspace = true | ||
readme.workspace = true | ||
homepage.workspace = true | ||
keywords.workspace = true | ||
authors.workspace = true | ||
rust-version.workspace = true | ||
edition.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde = { workspace = true, features = ["derive"] } | ||
chrono.workspace = true |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod edge_ref; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use self::edges::edge_ref::EdgeRef; | ||
|
||
pub mod edges; | ||
|
||
// the only reason this is public is because the physical ids of the nodes don't move | ||
#[repr(transparent)] | ||
#[derive( | ||
Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, Default, | ||
)] | ||
pub struct VID(pub usize); | ||
|
||
impl VID { | ||
pub fn index(&self) -> usize { | ||
self.0 | ||
} | ||
|
||
pub fn as_u64(&self) -> u64 { | ||
self.0 as u64 | ||
} | ||
} | ||
|
||
impl From<usize> for VID { | ||
fn from(id: usize) -> Self { | ||
VID(id) | ||
} | ||
} | ||
|
||
impl From<VID> for usize { | ||
fn from(id: VID) -> Self { | ||
id.0 | ||
} | ||
} | ||
|
||
#[repr(transparent)] | ||
#[derive( | ||
Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, Default, | ||
)] | ||
pub struct EID(pub usize); | ||
|
||
impl From<EID> for usize { | ||
fn from(id: EID) -> Self { | ||
id.0 | ||
} | ||
} | ||
|
||
impl From<usize> for EID { | ||
fn from(id: usize) -> Self { | ||
EID(id) | ||
} | ||
} | ||
|
||
#[derive( | ||
Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, Default, | ||
)] | ||
pub struct ELID { | ||
edge: EID, | ||
layer: Option<usize>, | ||
} | ||
|
||
impl ELID { | ||
pub fn new(edge: EID, layer: Option<usize>) -> Self { | ||
Self { edge, layer } | ||
} | ||
pub fn pid(&self) -> EID { | ||
self.edge | ||
} | ||
|
||
pub fn layer(&self) -> Option<usize> { | ||
self.layer | ||
} | ||
} | ||
|
||
impl From<EdgeRef> for ELID { | ||
fn from(value: EdgeRef) -> Self { | ||
ELID { | ||
edge: value.pid(), | ||
layer: value.layer().copied(), | ||
} | ||
} | ||
} | ||
impl EID { | ||
pub fn from_u64(id: u64) -> Self { | ||
EID(id as usize) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
pub mod entities; | ||
pub mod storage; | ||
|
||
/// Denotes the direction of an edge. Can be incoming, outgoing or both. | ||
#[derive( | ||
Clone, | ||
Copy, | ||
Hash, | ||
Eq, | ||
PartialEq, | ||
PartialOrd, | ||
Debug, | ||
Default, | ||
serde::Serialize, | ||
serde::Deserialize, | ||
)] | ||
pub enum Direction { | ||
OUT, | ||
IN, | ||
#[default] | ||
BOTH, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod timeindex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
use std::{fmt, ops::Range}; | ||
|
||
use chrono::{DateTime, Utc}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Ord, PartialOrd, Eq)] | ||
pub struct TimeIndexEntry(pub i64, pub usize); | ||
|
||
pub trait AsTime: fmt::Debug + Copy + Ord + Eq + Send + Sync + 'static { | ||
fn t(&self) -> i64; | ||
|
||
fn dt(&self) -> Option<DateTime<Utc>> { | ||
let t = self.t(); | ||
DateTime::from_timestamp_millis(t) | ||
} | ||
|
||
fn range(w: Range<i64>) -> Range<Self>; | ||
|
||
fn i(&self) -> usize { | ||
0 | ||
} | ||
|
||
fn new(t: i64, s: usize) -> Self; | ||
} | ||
|
||
impl From<i64> for TimeIndexEntry { | ||
fn from(value: i64) -> Self { | ||
Self::start(value) | ||
} | ||
} | ||
|
||
impl TimeIndexEntry { | ||
pub const MIN: TimeIndexEntry = TimeIndexEntry(i64::MIN, 0); | ||
|
||
pub const MAX: TimeIndexEntry = TimeIndexEntry(i64::MAX, usize::MAX); | ||
pub fn new(t: i64, s: usize) -> Self { | ||
Self(t, s) | ||
} | ||
|
||
pub fn start(t: i64) -> Self { | ||
Self(t, 0) | ||
} | ||
|
||
pub fn end(t: i64) -> Self { | ||
Self(t.saturating_add(1), 0) | ||
} | ||
} | ||
|
||
impl AsTime for i64 { | ||
fn t(&self) -> i64 { | ||
*self | ||
} | ||
|
||
fn range(w: Range<i64>) -> Range<Self> { | ||
w | ||
} | ||
|
||
fn new(t: i64, _s: usize) -> Self { | ||
t | ||
} | ||
} | ||
|
||
impl AsTime for TimeIndexEntry { | ||
fn t(&self) -> i64 { | ||
self.0 | ||
} | ||
fn range(w: Range<i64>) -> Range<Self> { | ||
Self::start(w.start)..Self::start(w.end) | ||
} | ||
|
||
fn i(&self) -> usize { | ||
self.1 | ||
} | ||
|
||
fn new(t: i64, s: usize) -> Self { | ||
Self(t, s) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod core; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,46 @@ | ||
[package] | ||
name = "raphtory-arrow" | ||
version = "0.8.1" | ||
documentation = "https://raphtory.readthedocs.io/en/latest/" | ||
repository = "https://github.com/Raphtory/raphtory-arrow/" | ||
license = "GPL-3.0" | ||
readme = "README.md" | ||
homepage = "https://github.com/Raphtory/raphtory-arrow/" | ||
keywords = ["graph", "temporal-graph", "temporal"] | ||
authors = ["Pometry"] | ||
rust-version = "1.77" | ||
edition = "2021" | ||
|
||
[profile.release-with-debug] | ||
inherits = "release" | ||
debug = true | ||
|
||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
raphtory-api = { path = "../raphtory-api", version = "0.8.1" } | ||
ahash = { version = "0.8", features = ["serde"] } | ||
bincode = "1.3.3" | ||
bytemuck = "1.16.0" | ||
itertools = "0.12.1" | ||
memmap2 = "0.9.4" | ||
num-traits = "0.2.19" | ||
once_cell = "1.19.0" | ||
parking_lot = "0.12.2" | ||
polars-arrow = "0.39.2" | ||
polars-parquet = { version = "0.39.2", features = ["compression"] } | ||
polars-utils = "0.39.2" | ||
rayon = "1.10.0" | ||
serde = "1.0.201" | ||
serde_json = "1.0.117" | ||
strum = { version = "0.26.2", features = ["derive"] } | ||
tempfile = "3.10.1" | ||
thiserror = "1.0.60" | ||
tracing = "0.1.40" | ||
tracing-subscriber = "0.3.18" | ||
twox-hash = "1.6.3" | ||
|
||
[dev-dependencies] | ||
proptest = "1.4.0" | ||
tracing-test = "0.2.4" |
Oops, something went wrong.