ArticleslgStudy

computer science

Frequent subtree mining

Frequent subtree mining is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Frequent subtree mining rather than just read about it. In short: In computer science, frequent subtree mining is the problem of finding all patterns in a given database whose support (a metric related to its number of occurrences in other subtrees) is over a given threshold. It is a more general form of the maximum agreement subtree problem.

Key takeaways

  • Frequent subtree mining belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Frequent subtree mining to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Frequent subtree mining from memory before moving on to harder problems.

Reference excerpt

In computer science, frequent subtree mining is the problem of finding all patterns in a given database whose support (a metric related to its number of occurrences in other subtrees) is over a given threshold. It is a more general form of the maximum agreement subtree problem.

Definition Frequent subtree mining is the problem of trying to find all of the patterns whose "support" is over a certain user-specified level, where "support" is calculated as the number of trees in a database which have at least one subtree isomorphic to a given pattern.

Formal definition The problem of frequent subtree mining has been formally defined as:

Given a threshold minfreq, a class of trees 𝒞, a transitive subtree relation P⪯T between trees P,T∈𝒞, a finite set of trees 𝒟⊆𝒞, the frequent subtree mining problem is the problem of finding all trees 𝒫⊂𝒞 such that no two trees in 𝒫 are isomorphic and ∀P∈𝒫:freq(P,𝒟)=∑T∈𝒟d(P,T)≥minfreq, where d is an anti-monotone function such that if P′⪯P then ∀T∈𝒞:d(P′,T)≥d(P,T).

TreeMiner In 2002, Mohammed J. Zaki introduced TreeMiner, an efficient algorithm for solving the frequent subtree mining problem, which used a "scope list" to represent tree nodes and which was contrasted with PatternMatcher, an algorithm based on pattern matching.

Definitions

Induced sub-trees A sub-tree S=(Vs,Es) is an induced sub-tree of T=(V,E) if and only if Vs⊆V and Es⊆E. In other words, any two nodes in S that are directly connected by an edge is also directly connected in T. For any node A and B in S, if node A is the parent of node B in S, then node A must also be the parent of node B in T.

Embedded sub-trees A sub-tree S=(Vs,Es) is an embedded sub-tree of T=(V,E) if and only if Vs⊆V and two endpoint nodes of any edge in S are on the same path from the root to a leaf node in T. In other words, for any node A and B in S, if node A is the parent of node B in S, then node A must be an ancestor of node B in T. Any induced sub-trees are also embedded sub-trees, and thus the concept of embedded sub-trees is a generalization of induced sub-trees. As such embedded sub-trees characterizes the hidden patterns in a tree that are missing in traditional induced sub-tree mining. A sub-tree of size k is often called a k-sub-tree.

Support The support of a sub-tree is the number of trees in a database that contains the sub-tree. A sub-tree is frequent if its support is not less than a user-specified threshold (often denoted as minsup). The goal of TreeMiner is to find all embedded sub-trees that have support at least the minimum support.

String representation of trees There are several different ways of encoding a tree structure. TreeMiner uses string representations of trees for efficient tree manipulation and support counting. Initially the string is set to ∅. Starting from the root of the tree, node labels are added to the string in depth-first search order. -1 is added to the string whenever the search process backtracks from a child to its parent. For example, a simple binary tree with root labelled A, a left child labelled B and right child labelled C can be represented by a string A B -1 C -1.

Prefix equivalence class Two k-sub-trees are said to be in the same prefix equivalence class if the string representation of them are identical up to the (k-1)-th node. In other words, all elements in a prefix equivalence class only differ by the last node. For example, two trees with string representation A B -1 C -1 and A B -1 D -1 are in the prefix equivalence class A B with elements (C, 0) and (D,0). An element of a prefix class is specified by the node label paired with the 0-based depth first index of the node it is attached to. In this example, both elements of prefix class A B are attached to the root, which has an index of 0.

Scope The scope of a node A is given by a pair of numbers [l,r] where l and r are the minimum and maximum node index in the sub-tree rooted at A. In other words, l is the index of A, and r is the index of the rightmost leaf among the descendants of A. As such the index of any descendant of A must lie in the scope of A, which will be a very useful property when counting the support of sub-trees.

Algorithm

Candidate generation Frequent sub-tree patterns follow the anti-monotone property. In other words, the support of a k-sub-tree is less than or equal to the support of its (k-1)-sub-trees. Only super patterns of known frequent patterns can possibly be frequent. By utilizing this property, k-sub-trees candidates can be generated based on frequent (k-1)-sub-trees through prefix class extension. Let C be a prefix equivalence class with two elements (x,i) and (y,j). Let C' be the class representing the extension of element (x,i). The elements of C' are added by performing join operation on the two (k-1)-sub-trees in C. The join operation on (x,i) and (y,j) is defined as the following.

If i>j, then add (y,j) to C'. If i=j, then add (y,j) and (y, ni) to C' where ni the depth-first index of x in C If i<j, no possible element can be added to C' This operation is repeated for any two ordered, but not necessarily distinct elements in C to construct the extended prefix classes of k-sub-trees.

Scope-list representation TreeMiner performs depth first candidate generation using scope-list representation of sub-trees to facilitate faster support counting. A k-sub-tree S can be representation by a triplet (t,m,s) where t is the tree id the sub-tree comes from, m is the prefix match label, and s the scope of the last node in S. Depending on how S occurs in different trees across the database, S can have different scope-list representation. TreeMiner defines scope-list join that performs class extension on scope-list representation of sub-trees. Two elements (x,i) and (y,j) can be joined if there exists two sub-trees (tx,mx,sx)and (ty,my,sy) that satisfy either of the following conditions.

In-scope test: tx=ty,mx=my,sy⊂sx, which corresponds to the case when i=j. Out-scope test: tx=ty,mx=my,sy>sx, which correspond to the case when i>j. By keeping track of distinct tree ids used in the scope-list tests, the support of sub-trees can be calculated efficiently.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Frequent subtree mining

Start with the simplest possible case. Write down what Frequent subtree mining claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Frequent subtree mining before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Frequent subtree mining ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Frequent subtree mining

In research
Frequent subtree mining appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Frequent subtree mining in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Frequent subtree mining is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational problems in graph theory, so understanding it makes those chapters shorter.
In everyday life
Look for Frequent subtree mining outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Frequent subtree mining” →

How to study Frequent subtree mining in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Frequent subtree mining means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Frequent subtree mining out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Frequent subtree mining in simple terms?

In computer science, frequent subtree mining is the problem of finding all patterns in a given database whose support (a metric related to its number of occurrences in other subtrees) is over a given threshold. It is a more general form of the maximum agreement subtree problem.

Why does Frequent subtree mining matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Frequent subtree mining?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Frequent subtree mining.

Tags

  • Computational problems in graph theory

Keep exploring