Tree Decomposition Visualizer

bags & tree structure

CalculatorsFreeNo Signup
4.9(338 reviews)
All Tools

Loading tool...

About Tree Decomposition Visualizer

A tree decomposition visualizer showing bags of vertices forming a tree. Every vertex appears in ≥1 bag; every edge has both endpoints in some bag; bags containing each vertex form a subtree. Width = max bag size - 1. Key to treewidth. Client-side.

Tree Decomposition Visualizer Features

  • Bag visualization
  • Tree structure
  • Width display
  • Intersection
  • Common graphs
Tree decomposition: organize vertices into bags forming a tree. Three rules: (1) every vertex in ≥1 bag, (2) every edge has both endpoints in a bag, (3) bags containing each vertex form a connected subtree. Width = max bag size - 1. Treewidth = min width.

How to Use

Select graph:

  • Bags: Vertex groups
  • Tree: Bag connections
  • Width: Max bag - 1

Properties

Running intersection property: bags containing vertex v form subtree. This ensures 'locality'. Width 1: graph is a forest. Width 2: series-parallel. Width 3: includes planar graphs. Many problems FPT in treewidth.

Algorithms on Decompositions

Dynamic programming on tree decomposition: 3-coloring in O(3^tw·n), independent set in O(2^tw·n), Hamiltonian cycle in O(2^tw·n). Courcelle's theorem: any MSO property in O(f(tw)·n). Extremely powerful framework.

Step-by-Step Instructions

  1. 1Select graph.
  2. 2View decomposition.
  3. 3Examine bags.
  4. 4Check properties.
  5. 5Compute width.

Tree Decomposition Visualizer — Frequently Asked Questions

What makes a 'good' tree decomposition?+

Small bags! Width = max bag size - 1. Minimum width over all valid decompositions = treewidth. Good decompositions have small, overlapping bags that cover the graph efficiently.

Why is this useful?+

Many NP-hard problems become polynomial on low-treewidth graphs via DP on tree decompositions. Practical applications: constraint satisfaction, Bayesian networks, DNA sequence analysis, circuit verification.

How do you find optimal decompositions?+

NP-hard in general. But FPT: O(2^tw·n) algorithm (Bodlaender). Heuristics: min-degree, min-fill, maximum cardinality search. For specific graph classes: polynomial algorithms exist.

Share this tool: