pub struct KnowledgeRelationGraph {
pub project_hash: String,
pub edges: Vec<KnowledgeEdge>,
pub updated_at: DateTime<Utc>,
}Fields§
§project_hash: String§edges: Vec<KnowledgeEdge>§updated_at: DateTime<Utc>Implementations§
Source§impl KnowledgeRelationGraph
impl KnowledgeRelationGraph
pub fn new(project_hash: &str) -> Self
pub fn path(project_hash: &str) -> Result<PathBuf, String>
pub fn load(project_hash: &str) -> Option<Self>
pub fn load_or_create(project_hash: &str) -> Self
pub fn save(&mut self) -> Result<(), String>
pub fn upsert_edge( &mut self, from: KnowledgeNodeRef, to: KnowledgeNodeRef, kind: KnowledgeEdgeKind, session_id: &str, ) -> bool
pub fn remove_edge( &mut self, from: &KnowledgeNodeRef, to: &KnowledgeNodeRef, kind: Option<KnowledgeEdgeKind>, ) -> usize
pub fn enforce_cap(&mut self, max_edges: usize) -> bool
Sourcepub fn strengthen_edge(
&mut self,
from: &KnowledgeNodeRef,
to: &KnowledgeNodeRef,
amount: f64,
) -> bool
pub fn strengthen_edge( &mut self, from: &KnowledgeNodeRef, to: &KnowledgeNodeRef, amount: f64, ) -> bool
Hebbian strengthening: saturating formula so strength approaches but never exceeds 1.0
Sourcepub fn decay_all_edges(&mut self, days_elapsed: f64)
pub fn decay_all_edges(&mut self, days_elapsed: f64)
Time-based exponential decay on all edge strengths
Sourcepub fn prune_weak_edges(&mut self, threshold: f64) -> usize
pub fn prune_weak_edges(&mut self, threshold: f64) -> usize
Remove edges whose strength has fallen below threshold
Trait Implementations§
Source§impl Clone for KnowledgeRelationGraph
impl Clone for KnowledgeRelationGraph
Source§fn clone(&self) -> KnowledgeRelationGraph
fn clone(&self) -> KnowledgeRelationGraph
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KnowledgeRelationGraph
impl Debug for KnowledgeRelationGraph
Source§impl Default for KnowledgeRelationGraph
impl Default for KnowledgeRelationGraph
Source§impl<'de> Deserialize<'de> for KnowledgeRelationGraphwhere
KnowledgeRelationGraph: Default,
impl<'de> Deserialize<'de> for KnowledgeRelationGraphwhere
KnowledgeRelationGraph: Default,
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
Auto Trait Implementations§
impl Freeze for KnowledgeRelationGraph
impl RefUnwindSafe for KnowledgeRelationGraph
impl Send for KnowledgeRelationGraph
impl Sync for KnowledgeRelationGraph
impl Unpin for KnowledgeRelationGraph
impl UnsafeUnpin for KnowledgeRelationGraph
impl UnwindSafe for KnowledgeRelationGraph
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<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