## org.apache.mahout.fpm.pfpgrowth.fpgrowth2
Class FPTree

    java.lang.Object
      org.apache.mahout.fpm.pfpgrowth.fpgrowth2.FPTree

    public final class FPTree

extends Object

A straightforward implementation of FPTrees as described in Han et. al.

Nested Class Summary
`static class` `FPTree.FPNode`

Constructor Summary
`FPTree(long[] attrCounts, long minSupport)` Creates an FPTree using the attribute counts in attrCounts.
`FPTree(LongArrayList attrCountList, long minSupport)` Creates an FPTree using the attribute counts in attrCountList.

Method Summary
`void` `accumulate(IntArrayList argItems, long count)` Adds an itemset with the given occurrance count.
`void` `accumulate(List<Integer> argItems, long count)` Adds an itemset with the given occurrance count.
`Iterable<Integer>` `attrIterableRev()` Returns an Iterable over the attributes in the tree, sorted by frequency (high to low).
`FPTree` `createMoreFreqConditionalTree(int targetAttr)` Returns a conditional FP tree based on the targetAttr, containing only items that are more frequent.
`long` `headerCount(int attribute)` Returns the count of the given attribute, as supplied on construction.
`FPTree.FPNode` `root()` Returns the root node of the tree.
`Pair<FPTree,FPTree>` `splitSinglePrefix()` Return a pair of trees that result from separating a common prefix (if one exists) from the lower portion of this tree.
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FPTree

    public FPTree(LongArrayList attrCountList,
                  long minSupport)

  Creates an FPTree using the attribute counts in attrCountList. Note that the counts in attrCountList are assumed to be complete; they are not updated as the tree is modified.

### FPTree

    public FPTree(long[] attrCounts,
                  long minSupport)

  Creates an FPTree using the attribute counts in attrCounts. Note that the counts in attrCounts are assumed to be complete; they are not updated as the tree is modified.

Method Detail

### headerCount

    public long headerCount(int attribute)

  Returns the count of the given attribute, as supplied on construction.

### root

    public FPTree.FPNode root()

  Returns the root node of the tree.

### accumulate

    public void accumulate(IntArrayList argItems,
                           long count)

  Adds an itemset with the given occurrance count.

### accumulate

    public void accumulate(List<Integer> argItems,
                           long count)

  Adds an itemset with the given occurrance count.

### attrIterableRev

    public Iterable<Integer> attrIterableRev()

  Returns an Iterable over the attributes in the tree, sorted by frequency (high to low).

### createMoreFreqConditionalTree

    public FPTree createMoreFreqConditionalTree(int targetAttr)

  Returns a conditional FP tree based on the targetAttr, containing only items that are more frequent.

### splitSinglePrefix

    public Pair<FPTree,FPTree> splitSinglePrefix()

  Return a pair of trees that result from separating a common prefix (if one exists) from the lower portion of this tree.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.