pub struct UcmEdge {
pub relation_type: RelationType,
pub confidence: f64,
pub evidence: Vec<EvidenceSource>,
pub discovered_at: DateTime<Utc>,
pub verified_at: Option<DateTime<Utc>>,
pub decay_rate: f64,
}Expand description
An edge in the context graph with confidence scoring and provenance.
Fields§
§relation_type: RelationTypeWhat kind of relationship this represents
confidence: f64Fused confidence score in [0.0, 1.0] Updated via Bayesian fusion from multiple evidence sources
evidence: Vec<EvidenceSource>Individual evidence sources that contributed to this edge
discovered_at: DateTime<Utc>When this edge was first discovered
verified_at: Option<DateTime<Utc>>When this edge was last verified (by test, trace, or re-analysis)
decay_rate: f64Decay rate (lambda) for temporal confidence decay
- Import statements: λ ≈ 0.001 (very slow decay)
- Call graph edges: λ ≈ 0.005 (slow decay)
- Heuristic inferences: λ ≈ 0.05 (moderate decay)
- API traffic patterns: λ ≈ 0.1 (fast decay)
Implementations§
Source§impl UcmEdge
impl UcmEdge
Sourcepub fn new(
relation_type: RelationType,
source: DiscoverySource,
confidence: f64,
description: impl Into<String>,
) -> Self
pub fn new( relation_type: RelationType, source: DiscoverySource, confidence: f64, description: impl Into<String>, ) -> Self
Create a new edge with a single initial evidence source.
Sourcepub fn add_evidence(
&mut self,
source: DiscoverySource,
confidence: f64,
description: impl Into<String>,
)
pub fn add_evidence( &mut self, source: DiscoverySource, confidence: f64, description: impl Into<String>, )
Add new evidence and re-fuse confidence using Bayesian update.
When sources agree, confidence compounds; when they conflict, the system expresses uncertainty rather than picking a winner.
Sourcepub fn decayed_confidence(&self) -> f64
pub fn decayed_confidence(&self) -> f64
Get the current confidence after applying temporal decay.
confidence(t) = base_confidence × exp(-λ × days_since_verification) Reference: TempValid framework (ACL 2024)