Struct Tree

Source
pub struct Tree<T> { /* private fields */ }
Expand description

Tree<T> represents the main tree data struct will be used during the FP-Growth algorithm.

Implementations§

Source§

impl<T: ItemType> Tree<T>

Source

pub fn new() -> Tree<T>

Create a new FP-Growth tree with an empty root node.

Source

pub fn generate_partial_tree(paths: &[Vec<Rc<Node<T>>>]) -> Tree<T>

Generate a partial tree with the given paths. This function will be called during the algorithm.

Source

pub fn add_transaction(&mut self, transaction: Vec<T>)

Iterate the transaction and add every item to the FP-Growth tree.

Source

pub fn update_route(&mut self, node: Rc<Node<T>>)

Update the route table that records the item and its node list.

Source

pub fn generate_prefix_path(&self, item: T) -> Vec<Vec<Rc<Node<T>>>>

Generate the prefix paths that end with the given item.

Source

pub fn get_all_nodes(&self, item: T) -> Vec<Rc<Node<T>>>

Get all nodes that holds the given item.

Source

pub fn get_all_items_nodes(&self) -> Vec<(T, Vec<Rc<Node<T>>>)>

Get all nodes with the given item.

Source

pub fn print(&self)

Print out the tree.

Trait Implementations§

Source§

impl<T: ItemType> Default for Tree<T>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<T> !Freeze for Tree<T>

§

impl<T> !RefUnwindSafe for Tree<T>

§

impl<T> !Send for Tree<T>

§

impl<T> !Sync for Tree<T>

§

impl<T> Unpin for Tree<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Tree<T>

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, 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.