pub struct DuplicateCluster {
pub id: usize,
pub members: Vec<PathBuf>,
pub edges: Vec<(usize, usize, f64)>,
pub representative: Option<PathBuf>,
}Expand description
A cluster of near-duplicate media files.
Fields§
§id: usizeUnique cluster identifier.
members: Vec<PathBuf>Members of this cluster (file paths).
edges: Vec<(usize, usize, f64)>Pairwise similarity scores (index_a, index_b, score).
representative: Option<PathBuf>The representative file selected for this cluster.
Implementations§
Source§impl DuplicateCluster
impl DuplicateCluster
Sourcepub fn add_member(&mut self, path: PathBuf)
pub fn add_member(&mut self, path: PathBuf)
Add a member file to the cluster.
Sourcepub fn add_edge(&mut self, a: usize, b: usize, score: f64)
pub fn add_edge(&mut self, a: usize, b: usize, score: f64)
Record a similarity edge between two member indices.
Sourcepub fn is_duplicate_group(&self) -> bool
pub fn is_duplicate_group(&self) -> bool
Returns true if the cluster has at least two members.
Sourcepub fn average_similarity(&self) -> f64
pub fn average_similarity(&self) -> f64
Average similarity score across all edges.
Sourcepub fn select_representative(&mut self)
pub fn select_representative(&mut self)
Select the representative member: the one with the highest average similarity to others.
Trait Implementations§
Source§impl Clone for DuplicateCluster
impl Clone for DuplicateCluster
Source§fn clone(&self) -> DuplicateCluster
fn clone(&self) -> DuplicateCluster
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 moreAuto Trait Implementations§
impl Freeze for DuplicateCluster
impl RefUnwindSafe for DuplicateCluster
impl Send for DuplicateCluster
impl Sync for DuplicateCluster
impl Unpin for DuplicateCluster
impl UnsafeUnpin for DuplicateCluster
impl UnwindSafe for DuplicateCluster
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> 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