
- Graph Theory - Home
- Graph Theory - Introduction
- Graph Theory - History
- Graph Theory - Fundamentals
- Graph Theory - Applications
- Types of Graphs
- Graph Theory - Types of Graphs
- Graph Theory - Simple Graphs
- Graph Theory - Multi-graphs
- Graph Theory - Directed Graphs
- Graph Theory - Weighted Graphs
- Graph Theory - Bipartite Graphs
- Graph Theory - Complete Graphs
- Graph Theory - Subgraphs
- Graph Theory - Trees
- Graph Theory - Forests
- Graph Theory - Planar Graphs
- Graph Theory - Hypergraphs
- Graph Theory - Infinite Graphs
- Graph Theory - Random Graphs
- Graph Representation
- Graph Theory - Graph Representation
- Graph Theory - Adjacency Matrix
- Graph Theory - Adjacency List
- Graph Theory - Incidence Matrix
- Graph Theory - Edge List
- Graph Theory - Compact Representation
- Graph Theory - Incidence Structure
- Graph Theory - Matrix-Tree Theorem
- Graph Properties
- Graph Theory - Basic Properties
- Graph Theory - Coverings
- Graph Theory - Matchings
- Graph Theory - Independent Sets
- Graph Theory - Traversability
- Graph Theory Connectivity
- Graph Theory - Connectivity
- Graph Theory - Vertex Connectivity
- Graph Theory - Edge Connectivity
- Graph Theory - k-Connected Graphs
- Graph Theory - 2-Vertex-Connected Graphs
- Graph Theory - 2-Edge-Connected Graphs
- Graph Theory - Strongly Connected Graphs
- Graph Theory - Weakly Connected Graphs
- Graph Theory - Connectivity in Planar Graphs
- Graph Theory - Connectivity in Dynamic Graphs
- Special Graphs
- Graph Theory - Regular Graphs
- Graph Theory - Complete Bipartite Graphs
- Graph Theory - Chordal Graphs
- Graph Theory - Line Graphs
- Graph Theory - Complement Graphs
- Graph Theory - Graph Products
- Graph Theory - Petersen Graph
- Graph Theory - Cayley Graphs
- Graph Theory - De Bruijn Graphs
- Graph Algorithms
- Graph Theory - Graph Algorithms
- Graph Theory - Breadth-First Search
- Graph Theory - Depth-First Search (DFS)
- Graph Theory - Dijkstra's Algorithm
- Graph Theory - Bellman-Ford Algorithm
- Graph Theory - Floyd-Warshall Algorithm
- Graph Theory - Johnson's Algorithm
- Graph Theory - A* Search Algorithm
- Graph Theory - Kruskal's Algorithm
- Graph Theory - Prim's Algorithm
- Graph Theory - Borůvka's Algorithm
- Graph Theory - Ford-Fulkerson Algorithm
- Graph Theory - Edmonds-Karp Algorithm
- Graph Theory - Push-Relabel Algorithm
- Graph Theory - Dinic's Algorithm
- Graph Theory - Hopcroft-Karp Algorithm
- Graph Theory - Tarjan's Algorithm
- Graph Theory - Kosaraju's Algorithm
- Graph Theory - Karger's Algorithm
- Graph Coloring
- Graph Theory - Coloring
- Graph Theory - Edge Coloring
- Graph Theory - Total Coloring
- Graph Theory - Greedy Coloring
- Graph Theory - Four Color Theorem
- Graph Theory - Coloring Bipartite Graphs
- Graph Theory - List Coloring
- Advanced Topics of Graph Theory
- Graph Theory - Chromatic Number
- Graph Theory - Chromatic Polynomial
- Graph Theory - Graph Labeling
- Graph Theory - Planarity & Kuratowski's Theorem
- Graph Theory - Planarity Testing Algorithms
- Graph Theory - Graph Embedding
- Graph Theory - Graph Minors
- Graph Theory - Isomorphism
- Spectral Graph Theory
- Graph Theory - Graph Laplacians
- Graph Theory - Cheeger's Inequality
- Graph Theory - Graph Clustering
- Graph Theory - Graph Partitioning
- Graph Theory - Tree Decomposition
- Graph Theory - Treewidth
- Graph Theory - Branchwidth
- Graph Theory - Graph Drawings
- Graph Theory - Force-Directed Methods
- Graph Theory - Layered Graph Drawing
- Graph Theory - Orthogonal Graph Drawing
- Graph Theory - Examples
- Computational Complexity of Graph
- Graph Theory - Time Complexity
- Graph Theory - Space Complexity
- Graph Theory - NP-Complete Problems
- Graph Theory - Approximation Algorithms
- Graph Theory - Parallel & Distributed Algorithms
- Graph Theory - Algorithm Optimization
- Graphs in Computer Science
- Graph Theory - Data Structures for Graphs
- Graph Theory - Graph Implementations
- Graph Theory - Graph Databases
- Graph Theory - Query Languages
- Graph Algorithms in Machine Learning
- Graph Neural Networks
- Graph Theory - Link Prediction
- Graph-Based Clustering
- Graph Theory - PageRank Algorithm
- Graph Theory - HITS Algorithm
- Graph Theory - Social Network Analysis
- Graph Theory - Centrality Measures
- Graph Theory - Community Detection
- Graph Theory - Influence Maximization
- Graph Theory - Graph Compression
- Graph Theory Real-World Applications
- Graph Theory - Network Routing
- Graph Theory - Traffic Flow
- Graph Theory - Web Crawling Data Structures
- Graph Theory - Computer Vision
- Graph Theory - Recommendation Systems
- Graph Theory - Biological Networks
- Graph Theory - Social Networks
- Graph Theory - Smart Grids
- Graph Theory - Telecommunications
- Graph Theory - Knowledge Graphs
- Graph Theory - Game Theory
- Graph Theory - Urban Planning
- Graph Theory Useful Resources
- Graph Theory - Quick Guide
- Graph Theory - Useful Resources
- Graph Theory - Discussion
Graph Theory - Tree Decomposition
Tree Decomposition
Tree Decomposition is used to map a graph into a tree-like structure. It provides a way to analyze and solve problems on complex graphs by breaking them into simpler components. The main idea is to break the graph into smaller, overlapping subsets of vertices, organized in a tree structure, where each subset represents a "bag".

The above diagram shows how a graph is represented as a tree decomposition, with vertices grouped into overlapping bags connected in a tree structure.
Properties of Tree Decomposition
Following are the important properties of tree decomposition −
- Bag Coverage: Each vertex of the graph must appear in at least one bag of the tree decomposition.
- Edge Coverage: For every edge in the graph, both vertices of the edge must appear together in at least one bag.
- Connected Bags: For any vertex in the graph, the bags containing that vertex must form a connected subtree in the decomposition tree.
Treewidth
Treewidth is a measure of how closely a graph resembles a tree. It is defined as the size of the largest bag in the tree decomposition, minus one.
In other words, it represents how complex the connections are in the graph when viewed through a tree-like decomposition. A graph with treewidth 1 is a tree itself, while higher treewidth values indicate more complex graphs.
The treewidth of a graph is formally defined as:
Treewidth = max(|Bag|) - 1
For example, a tree has a treewidth of 1, while a complete graph with n vertices has a treewidth of n - 1.
Constructing a Tree Decomposition
The process of constructing a tree decomposition involves dividing the graph into overlapping subsets of vertices and arranging them in a tree structure. The steps are −
- Identify subsets of vertices (bags) such that each vertex and edge of the graph is covered.
- Ensure the bags satisfy the properties of bag coverage, edge coverage, and connected bags.
- Connect the bags in a tree structure.
Let us look at an example −
Graph: [(A, B), (A, C), (B, C), (C, D)] Tree Decomposition: Bag 1: [A, B, C] Bag 2: [C, D]
The decomposition ensures that all edges are covered, and bags containing the same vertex (e.g., C) form a connected subtree.

Applications of Tree Decomposition
Tree decomposition is useful in solving various complex problems in graph theory and real-world applications −
- Solving NP-hard Problems: Many NP-hard problems, such as graph coloring and finding Hamiltonian paths, become easier to solve on graphs with bounded treewidth.
- Constraint Satisfaction Problems (CSP): Tree decomposition helps break down CSPs into simpler subproblems, making them easier to solve.
- Database Query Optimization: In databases, tree decomposition helps improve query performance by reducing unnecessary calculations.
Tree Decomposition Algorithms
There are different algorithms used to find tree decompositions, such as −
- Naive Algorithm: A simple method that tries all possible options to create a decomposition.
- Greedy Algorithms: These use a step-by-step approach to build a decomposition by picking vertices or edges based on certain properties.
- Dynamic Programming: A faster method to compute tree decompositions for specific types of graphs, like chordal graphs.
Example: Naive Algorithm
The naive algorithm explores all possible subsets of vertices to construct a tree decomposition. For a small graph, this approach is feasible but inefficient for larger graphs.
Graph: [(A, B), (A, C), (B, C), (C, D)] Step 1: Identify subsets: Subset 1: [A, B, C] Subset 2: [C, D] Step 2: Connect subsets: Tree structure: [Subset 1 - Subset 2]