pub struct Edge {
pub id: EdgeId,
pub version: u64,
pub source: NodeId,
pub target: NodeId,
pub edge_type: EdgeType,
pub properties: PropertyMap,
pub created_at: i64,
}Expand description
A directed edge in the property graph
Edges have:
- A unique ID
- A source node (REQ-GRAPH-007: directed)
- A target node
- An edge type (relationship type)
- Properties (key-value pairs)
- Creation timestamp
Fields§
§id: EdgeIdUnique identifier for this edge
version: u64Version for MVCC
source: NodeIdSource node (edge goes FROM this node)
target: NodeIdTarget node (edge goes TO this node)
edge_type: EdgeTypeType of relationship (e.g., “KNOWS”, “WORKS_AT”)
properties: PropertyMapProperties associated with this edge
created_at: i64Creation timestamp (Unix milliseconds)
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn new(
id: EdgeId,
source: NodeId,
target: NodeId,
edge_type: impl Into<EdgeType>,
) -> Self
pub fn new( id: EdgeId, source: NodeId, target: NodeId, edge_type: impl Into<EdgeType>, ) -> Self
Create a new directed edge
Sourcepub fn new_with_properties(
id: EdgeId,
source: NodeId,
target: NodeId,
edge_type: impl Into<EdgeType>,
properties: PropertyMap,
) -> Self
pub fn new_with_properties( id: EdgeId, source: NodeId, target: NodeId, edge_type: impl Into<EdgeType>, properties: PropertyMap, ) -> Self
Create a new edge with properties
Sourcepub fn set_property(
&mut self,
key: impl Into<String>,
value: impl Into<PropertyValue>,
)
pub fn set_property( &mut self, key: impl Into<String>, value: impl Into<PropertyValue>, )
Set a property value
Sourcepub fn get_property(&self, key: &str) -> Option<&PropertyValue>
pub fn get_property(&self, key: &str) -> Option<&PropertyValue>
Get a property value
Sourcepub fn remove_property(&mut self, key: &str) -> Option<PropertyValue>
pub fn remove_property(&mut self, key: &str) -> Option<PropertyValue>
Remove a property
Sourcepub fn has_property(&self, key: &str) -> bool
pub fn has_property(&self, key: &str) -> bool
Check if property exists
Sourcepub fn property_count(&self) -> usize
pub fn property_count(&self) -> usize
Get number of properties
Sourcepub fn connects(&self, node1: NodeId, node2: NodeId) -> bool
pub fn connects(&self, node1: NodeId, node2: NodeId) -> bool
Check if this edge connects two specific nodes (in either direction)
Sourcepub fn starts_from(&self, node: NodeId) -> bool
pub fn starts_from(&self, node: NodeId) -> bool
Check if this edge goes FROM a specific node
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Edge
impl<'de> Deserialize<'de> for Edge
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Edge
Auto Trait Implementations§
impl Freeze for Edge
impl RefUnwindSafe for Edge
impl Send for Edge
impl Sync for Edge
impl Unpin for Edge
impl UnsafeUnpin for Edge
impl UnwindSafe for Edge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more