pub struct KnowledgeGraph {
pub nodes: Vec<GraphNode>,
pub edges: Vec<GraphEdge>,
}Expand description
Knowledge graph structure
Fields§
§nodes: Vec<GraphNode>§edges: Vec<GraphEdge>Implementations§
Source§impl KnowledgeGraph
impl KnowledgeGraph
Sourcepub fn from_data(memories: &[Memory], crossrefs: &[CrossReference]) -> Self
pub fn from_data(memories: &[Memory], crossrefs: &[CrossReference]) -> Self
Create graph from memories and cross-references
Sourcepub fn to_visjs_json(&self) -> Value
pub fn to_visjs_json(&self) -> Value
Export as vis.js compatible JSON
Source§impl KnowledgeGraph
impl KnowledgeGraph
Sourcepub fn stats(&self) -> GraphStats
pub fn stats(&self) -> GraphStats
Calculate graph statistics
Sourcepub fn centrality(&self) -> HashMap<MemoryId, CentralityScores>
pub fn centrality(&self) -> HashMap<MemoryId, CentralityScores>
Calculate centrality scores for nodes
Source§impl KnowledgeGraph
impl KnowledgeGraph
Sourcepub fn filter(&self, filter: &GraphFilter) -> KnowledgeGraph
pub fn filter(&self, filter: &GraphFilter) -> KnowledgeGraph
Apply filter to create a subgraph
Sourcepub fn neighborhood(&self, center: MemoryId, depth: usize) -> KnowledgeGraph
pub fn neighborhood(&self, center: MemoryId, depth: usize) -> KnowledgeGraph
Get subgraph centered on a node with given depth
Source§impl KnowledgeGraph
impl KnowledgeGraph
Sourcepub fn detect_communities(&self, max_iterations: usize) -> Vec<GraphCluster>
pub fn detect_communities(&self, max_iterations: usize) -> Vec<GraphCluster>
Detect communities using label propagation algorithm
Trait Implementations§
Source§impl Clone for KnowledgeGraph
impl Clone for KnowledgeGraph
Source§fn clone(&self) -> KnowledgeGraph
fn clone(&self) -> KnowledgeGraph
Returns a duplicate of the value. Read more
1.0.0 · 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 KnowledgeGraph
impl Debug for KnowledgeGraph
Source§impl<'de> Deserialize<'de> for KnowledgeGraph
impl<'de> Deserialize<'de> for KnowledgeGraph
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 KnowledgeGraph
impl RefUnwindSafe for KnowledgeGraph
impl Send for KnowledgeGraph
impl Sync for KnowledgeGraph
impl Unpin for KnowledgeGraph
impl UnwindSafe for KnowledgeGraph
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 moreCreates a shared type from an unshared type.