pub struct Edge {
pub source: Uuid,
pub target: Uuid,
pub kind: EdgeKind,
pub weight: Option<f32>,
pub metadata: Option<String>,
}Expand description
An edge in the semantic graph
Represents a directed relationship between two nodes. Per CP-001 §2.5: edges connect nodes with typed relationships.
Fields§
§source: UuidSource node ID
target: UuidTarget node ID
kind: EdgeKindType of relationship
weight: Option<f32>Optional weight/score (e.g., similarity score for ChunkToChunk)
Per CP-001: stored as f32 in range [0.0, 1.0]
metadata: Option<String>Optional metadata string (e.g., relationship context)
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn with_weight(
source: Uuid,
target: Uuid,
kind: EdgeKind,
weight: f32,
) -> Self
pub fn with_weight( source: Uuid, target: Uuid, kind: EdgeKind, weight: f32, ) -> Self
Create a weighted edge (e.g., for similarity scores)
Sourcepub fn doc_to_chunk(doc_id: Uuid, chunk_id: Uuid) -> Self
pub fn doc_to_chunk(doc_id: Uuid, chunk_id: Uuid) -> Self
Create a doc-to-chunk edge
Sourcepub fn chunk_to_embedding(chunk_id: Uuid, embedding_id: Uuid) -> Self
pub fn chunk_to_embedding(chunk_id: Uuid, embedding_id: Uuid) -> Self
Create a chunk-to-embedding edge
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
impl StructuralPartialEq 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