Skip to content

Graphs -> Tree Isomorphism

Canonical subtree encoding for rooted unordered trees, with unrooted comparison handled by trying one or two tree centers first.

  • Topic slug: graphs/tree-isomorphism
  • Tutorial page: Open tutorial
  • Ladder page: Open ladder
  • Repo problems currently tagged here: 1
  • Repo companion pages: 5
  • Curated external problems: 2

Microtopics

  • rooted-tree-isomorphism
  • canonical-encoding
  • ahu-style
  • tree-centers
  • unordered-children
  • subtree-signatures

Learning Sources

Source Type
Competitive Programming 4 contents Reference
CSES Tree Isomorphism I Practice
CSES Tree Isomorphism II Practice

Repo Companion Material

Material Type
Tree Isomorphism hot sheet quick reference
Tree Isomorphism I note flagship note
Trees tutorial compare point
Template Library exact starter route starter route
Graph cheatsheet quick reference

Curated External Problems

Core

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
Tree Isomorphism I CSES Hard Canonical Encoding Bottom-Up Canonicalization; Postorder; Structural Comparison Rooted Tree; DFS; Parent-Child Structure Rooted Tree; Canonical Form; Unordered Children The clean rooted benchmark where the whole task is comparing two unordered rooted trees by canonical subtree types.

Stretch

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
Tree Isomorphism II CSES Hard Tree Centers Center Rooting; Bottom-Up Canonicalization; Structural Comparison Tree Isomorphism I; Rooted Tree Unrooted Tree; Centers; Canonical Form The natural unrooted sibling: normalize by one or two centers, then reuse the rooted canonical-encoding primitive.

Repo Problems

Code Title Fit Difficulty Pattern Note Solution
TREEISOMORPHISM1 Tree Isomorphism I primary hard - Note Code

Regeneration

python3 scripts/generate_problem_catalog.py