pub struct ReferenceGraph {
pub nodes: Vec<String>,
pub edges: Vec<(String, String, ReferenceType, f64)>,
}Expand description
Reference graph for tracking relationships between documents.
Used by tier for hierarchical clustering of entity relationships.
Fields§
§nodes: Vec<String>Nodes: document IDs
edges: Vec<(String, String, ReferenceType, f64)>Edges: (source_doc, target_doc, reference_type, weight)
Implementations§
Source§impl ReferenceGraph
impl ReferenceGraph
Sourcepub fn add_document(&mut self, doc_id: &str)
pub fn add_document(&mut self, doc_id: &str)
Add a document node.
Sourcepub fn add_reference(
&mut self,
source_doc: &str,
target_doc: &str,
ref_type: ReferenceType,
weight: f64,
)
pub fn add_reference( &mut self, source_doc: &str, target_doc: &str, ref_type: ReferenceType, weight: f64, )
Add a reference edge between documents.
Sourcepub fn get_references(&self, doc_id: &str) -> Vec<(&str, &ReferenceType)>
pub fn get_references(&self, doc_id: &str) -> Vec<(&str, &ReferenceType)>
Get all documents referenced by a given document.
Sourcepub fn get_referrers(&self, doc_id: &str) -> Vec<(&str, &ReferenceType)>
pub fn get_referrers(&self, doc_id: &str) -> Vec<(&str, &ReferenceType)>
Get all documents that reference a given document.
Trait Implementations§
Source§impl Clone for ReferenceGraph
impl Clone for ReferenceGraph
Source§fn clone(&self) -> ReferenceGraph
fn clone(&self) -> ReferenceGraph
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 ReferenceGraph
impl Debug for ReferenceGraph
Source§impl Default for ReferenceGraph
impl Default for ReferenceGraph
Source§fn default() -> ReferenceGraph
fn default() -> ReferenceGraph
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ReferenceGraph
impl<'de> Deserialize<'de> for ReferenceGraph
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 ReferenceGraph
impl RefUnwindSafe for ReferenceGraph
impl Send for ReferenceGraph
impl Sync for ReferenceGraph
impl Unpin for ReferenceGraph
impl UnsafeUnpin for ReferenceGraph
impl UnwindSafe for ReferenceGraph
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