HeuristicMatching

Struct HeuristicMatching 

Source
pub struct HeuristicMatching { /* private fields */ }
Expand description

Heuristic matching algorithm for building correspondences between trees.

This implementation follows the algorithm described in the 3DM thesis:

  1. Find candidate matches using exact content hash or fuzzy matching
  2. Score candidates by counting matching descendants (DFS match)
  3. Select best candidate, resolving ambiguities using sibling context
  4. Remove small copies below copy_threshold
  5. Match similar unmatched nodes to neighbors’ siblings
  6. Set match types (FULL/CONTENT/CHILDREN) for copies

Implementations§

Source§

impl HeuristicMatching

Source

pub fn new() -> Self

Creates a new HeuristicMatching instance with default copy threshold.

Source

pub fn with_copy_threshold(copy_threshold: i32) -> Self

Creates a new HeuristicMatching instance with custom copy threshold.

Source

pub fn with_trees(base: &NodeRef, branch: &NodeRef) -> Self

Creates a new HeuristicMatching and builds the matching.

Source

pub fn set_is_left(&mut self, is_left: bool)

Sets whether this matching is for the left branch.

Source

pub fn copy_threshold(&self) -> i32

Returns the copy threshold.

Trait Implementations§

Source§

impl Default for HeuristicMatching

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Matching for HeuristicMatching

Source§

fn build_matching(&mut self, base: &NodeRef, branch: &NodeRef)

Builds a matching between a base tree and a branch tree. Read more
Source§

fn get_area_stop_nodes(&self, stop_nodes: &mut Vec<NodeRef>, node: &NodeRef)

Gets the children of leaf nodes in a matching subtree. Read more
Source§

fn base_root(&self) -> Option<&NodeRef>

Returns a reference to the base tree root.
Source§

fn branch_root(&self) -> Option<&NodeRef>

Returns a reference to the branch tree root.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.