pub struct Edge {
pub source_id: u64,
pub target_id: u64,
pub edge_type: EdgeType,
pub weight: f32,
pub created_at: u64,
pub context: u32,
}Expand description
A directed relationship between two code units.
Fields§
§source_id: u64Source code unit ID.
target_id: u64Target code unit ID.
edge_type: EdgeTypeType of relationship.
weight: f32Relationship strength (0.0 = weak, 1.0 = strong). For temporal edges, this is the confidence/frequency.
created_at: u64When this edge was established.
context: u32Additional context (e.g., call site line number).
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn new(source_id: u64, target_id: u64, edge_type: EdgeType) -> Self
pub fn new(source_id: u64, target_id: u64, edge_type: EdgeType) -> Self
Create a new edge with default weight of 1.0.
Sourcepub fn with_weight(self, weight: f32) -> Self
pub fn with_weight(self, weight: f32) -> Self
Set the weight (clamped to [0.0, 1.0]).
Sourcepub fn with_context(self, context: u32) -> Self
pub fn with_context(self, context: u32) -> Self
Set the context value.
Sourcepub fn is_self_edge(&self) -> bool
pub fn is_self_edge(&self) -> bool
Returns true if this is a self-edge (source == target).
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 Copy 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