Apriori vs. FP-Growth

Last Updated July 20, 2026

Both algorithms mine frequent itemsets using the same support requirement. Apriori generates and tests candidate itemsets level by level, while FP-Growth compresses frequent transaction prefixes into an FP-tree and mines conditional patterns recursively.

  • Use Apriori when the dataset and candidate space are small and every join, support count, and pruning decision should remain visible.
  • Use FP-Growth when candidate levels would become large and repeated transaction prefixes can be compressed effectively.
Apriori tests candidate levels; FP-Growth mines a compressed pattern tree.

Head-to-Head Showdown

Pattern Search Strategy

Apriori: Level-wise candidates

FP-Growth: Recursive pattern growth

The Implication: Apriori joins frequent itemsets to generate the next candidate level, prunes candidates with infrequent subsets, and counts their support. FP-Growth mines suffix patterns from conditional pattern bases and conditional FP-trees instead of constructing the same complete candidate levels.

Classic Database Processing

Apriori: Support scan per level

FP-Growth: Two initial passes

The Implication: Classic Apriori scans the transaction data to count singleton, pair, triple, and later candidate levels as needed. Classic FP-Growth first counts item frequencies, then builds the FP-tree in a second pass before recursively mining the tree and its conditional structures.

Main Performance Risk

Apriori: Candidate explosion

FP-Growth: Poor tree compression

The Implication: Apriori can generate very large candidate collections when many items remain frequent. FP-Growth avoids those full candidate levels, but its tree and conditional structures may still become large when transactions share few useful prefixes.

Selection Criteria

Scenario:A university exercise uses a small grocery dataset and requires every candidate itemset, support count, join, and pruning decision to be shown.

Choose Apriori:Apriori exposes the complete level-wise process through C1C_1, L1L_1, C2C_2, L2L_2, and later levels. FP-Growth can return the same frequent itemsets, but its FP-tree and conditional mining do not naturally display the requested candidate sequence.

Scenario:An e-commerce platform mines product combinations from millions of dense transactions containing many repeated purchasing prefixes.

Choose FP-Growth:FP-Growth can compress repeated transaction prefixes and avoid Apriori's complete candidate levels. Its practical advantage still depends on how well the data compresses and how large the resulting conditional structures become.

Scenario:An exam asks for all candidate 2-itemsets and 3-itemsets and requires pruning any candidate with an infrequent subset.

Choose Apriori:Candidate joining and downward-closure pruning are explicit parts of Apriori's search process. FP-Growth discovers patterns through conditional prefix structures rather than producing the same candidate tables.

Side By Side Trace

Both algorithms mine frequent itemsets from the same five grocery baskets using minimum support 60%60\%, equal to a support count of 33. No confidence threshold or association-rule generation is used. FP-Growth removes infrequent items, orders the three equal-support items alphabetically as bread, eggs, milk for this deterministic trace, and mines suffixes in reverse order. Another stable tie rule could produce a different-looking FP-tree while preserving the correct frequent itemsets and support counts.

Data PointTransaction Items
P1bread, milk, eggs
P2bread, milk
P3bread, eggs
P4milk, eggs
P5bread, milk, eggs, butter

Step 1: Find Frequent Singletons

Apriori

Apriori counts {bread}=4\{bread\}=4, {milk}=4\{milk\}=4, {eggs}=4\{eggs\}=4, and {butter}=1\{butter\}=1. With minimum support count 33, butter is removed and L1={{bread},{milk},{eggs}}L_1=\{\{bread\},\{milk\},\{eggs\}\}.

FP-Growth

FP-Growth performs the same frequency count and removes butter because 1<31<3. Bread, eggs, and milk each have support 44, so this trace resolves the tie alphabetically as bread, eggs, milk before building the FP-tree.

Step 2: Point of Divergence

Apriori

Apriori generates C2={{bread,milk},{bread,eggs},{milk,eggs}}C_2=\{\{bread,milk\},\{bread,eggs\},\{milk,eggs\}\}. Each pair has support count 33, so all three survive in L2L_2.

FP-Growth

FP-Growth removes butter, reorders each basket by the global item order, and inserts the ordered transactions into one FP-tree. Shared prefixes accumulate counts, producing root → bread:4, bread → eggs:3 → milk:2, bread → milk:1, and root → eggs:1 → milk:1.

Step 3: Expand Larger Patterns

Apriori

Apriori joins the three frequent pairs to form C3={{bread,eggs,milk}}C_3=\{\{bread,eggs,milk\}\}. All 2-item subsets are frequent, so it survives subset pruning, but its support count is 2<32<3, so it is rejected.

FP-Growth

For suffix milk, the conditional pattern base is [bread,eggs]:2[bread,eggs]:2, [bread]:1[bread]:1, and [eggs]:1[eggs]:1. It produces {bread,milk}=3\{bread,milk\}=3 and {eggs,milk}=3\{eggs,milk\}=3, while {bread,eggs,milk}=2\{bread,eggs,milk\}=2 is rejected. For suffix eggs, prefix [bread]:3[bread]:3 produces {bread,eggs}=3\{bread,eggs\}=3. For suffix bread, there is no non-empty prefix path, so no larger bread-ending pattern is added.

Step 4: Return the Same Itemsets

Apriori

Apriori returns the frequent singletons {bread}\{bread\}, {milk}\{milk\}, and {eggs}\{eggs\} with support 44, plus the three frequent pairs with support 33. It discovers them through explicit candidate generation, pruning, and support counting.

FP-Growth

FP-Growth returns the same three singletons and three pairs with identical support counts. It discovers them through the header counts, FP-tree paths, conditional pattern bases, and recursive pattern growth.

Final Result

Apriori:Apriori counts four singleton candidates, retains three, generates three frequent pair candidates, and rejects the only triple because its support is 22. It returns six frequent itemsets through level-wise candidate generation and support counting.

FP-Growth:FP-Growth removes butter, builds the compressed FP-tree, and mines conditional patterns for milk, eggs, and bread. It returns the same six frequent itemsets without constructing Apriori's complete pair and triple candidate levels. The algorithms differ in search representation, not in the definition of support or frequent itemsets.

Common Pitfalls & Exam Mistakes

  • Assuming FP-Growth avoids support counting.

    The Mistake: Students believe FP-Growth discovers patterns without calculating item or pattern support.

    Why It's Wrong: FP-Growth still counts item frequencies and derives pattern support from its FP-tree and conditional structures. It avoids Apriori's explicit candidate levels, not the need to verify frequency.

  • Thinking both algorithms directly return association rules.

    The Mistake: Students expect the mining step to immediately output implication rules with confidence and lift.

    Why It's Wrong: Both algorithms first identify frequent itemsets using minimum support. Association rules are generated afterward from those itemsets and filtered using measures such as confidence and lift.

  • Assuming FP-Growth stores no intermediate structures.

    The Mistake: Students believe only Apriori uses memory for intermediate mining results.

    Why It's Wrong: Apriori stores candidate and frequent-itemset levels, while FP-Growth stores an FP-tree, header links, conditional pattern bases, and possibly conditional trees. FP-Growth changes the intermediate representation rather than eliminating it.

Comparative Analysis

AttributeAprioriFP-Growth
Search StrategyLevel-wise candidate generationRecursive pattern growth
Main RepresentationCandidate and frequent levelsFP-tree and conditional trees
Classic Database PassesSupport pass per levelTwo initial passes
Pruning MechanismInfrequent-subset pruningFrequency filtering and conditional pruning
Main Performance RiskCandidate explosionPoor tree compression
Teaching VisibilityExplicit joins and candidatesTree paths and conditional patterns

Common Questions & Edge Cases

  • Should FP-Growth always replace Apriori for frequent-itemset mining?

    No. FP-Growth often avoids large candidate levels and repeated support scans, but its tree may compress poorly when transactions share few prefixes. Apriori can remain easier to implement, inspect, teach, and debug when the candidate space is small.

  • Do Apriori and FP-Growth return the same frequent itemsets?

    Yes. With identical transactions, preprocessing, minimum support, and itemset constraints, correct implementations should return the same frequent itemsets and support counts. They differ in how they search for those itemsets.

  • Does FP-Growth generate association rules directly?

    No. FP-Growth first mines frequent itemsets, just as Apriori does during its frequent-itemset stage. Association rules are generated afterward using measures such as confidence and lift.

  • Is FP-Growth always faster and more memory-efficient than Apriori?

    No. FP-Growth often performs better when candidate generation would be large and shared transaction prefixes compress well. Sparse or weakly compressible data can produce large trees and conditional structures, so performance should be measured on the actual dataset.

Explore the Algorithms in Action

Open the theory pages or try the interactive solvers for the algorithms compared above.