#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 4A::7.1.4 Binary Decision Diagrams (part 2)
#columns:Front	Back	Tags
TAOCP §7.1.4 Binary Decision Diagrams (part 2): what does it cover?	Part 2 covers the rest of 7.1.4 (book pages 233 to 258): most functions have large BDDs, why variable ordering can change sizes exponentially, finding a good order, local swaps and dynamic reordering by sifting (Algorithm J), read-once functions, the bad news for multiplication, and zero-suppressed BDDs (ZDDs) with their family algebra, used for exact cover, tilings, word lists, paths in graphs and prime implicants. It ends with a short history and a caveat about when BDDs are the wrong tool.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::about
TAOCP §7.1.4 (part 2): why does it matter?	Variable ordering can make a BDD tiny or exponential, a great lesson in representation choice. ZDDs are excellent for combinatorial families and come back in Vol 4B.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::why
ZDD (zero-suppressed decision diagram): what is it?	A ZDD is a variant of the binary decision diagram, introduced by Shin-ichi Minato, that represents families of sets compactly by removing nodes whose HI branch leads to 0.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::definition
ZDD (zero-suppressed decision diagram): When should I use a ZDD instead of a BDD?	When the objects are sets with few members out of many possible elements. For general Boolean functions, a BDD is usually the better fit.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::definition
TAOCP §7.1.4 (part 2): what is Algorithm J about?	Local swaps and dynamic reordering by sifting.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::algorithm
TAOCP §7.1.4 (part 2), a common trap: “Assuming a good variable order is easy to find.” What's the catch?	Finding the best order is expensive in general; heuristics like sifting are what you use in practice.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::trap
TAOCP §7.1.4 (part 2), a common trap: “Mixing up BDD and ZDD reduction rules.” What's the catch?	ZDDs remove nodes whose HI branch goes to false, not nodes with equal branches.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::trap
TAOCP §7.1.4 (part 2), exercise 147 (rated 27, recommended): what is it asking?	Work out the details of swapping two adjacent variables in place. The building block of every dynamic reordering heuristic.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2), exercise 187 (rated 20, recommended): what is it asking?	Draw the ZDDs for all 16 functions of two variables and compare with your BDDs.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2), exercise 198 (rated 23, recommended): what is it asking?	Write AND for ZDDs. Shows exactly where the different reduction rule changes the algorithm.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2), exercise 208 (rated 16, recommended): what is it asking?	Count solutions from a ZDD by modifying the BDD counting algorithm.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2), exercise 212 (rated 25, recommended): what is it asking?	Build a ZDD for an exact cover problem. Connects to the dancing links material in Vol 4B.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2), exercise 225 (rated 30, recommended): what is it asking?	Build a ZDD of all simple paths between two vertices. This is the idea behind the Simpath algorithm used to count paths on grids.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2), exercise 265 (rated 21, recommended): what is it asking?	Find the m-th smallest solution from a BDD. Ranking and unranking, which 7.2.1 uses throughout.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2), exercise 164 (rated M27, recommended): what is it asking?	Find the largest BDD a read-once function can have. The stretch.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercise
TAOCP §7.1.4 (part 2): how many exercises, and how are they rated?	267 exercises, rated 05 to M47.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::exercises
TAOCP §7.1.4 (part 2): what should you be comfortable with first?	<ul><li>7.1.4 part 1</li></ul>	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::prereqs
TAOCP §7.1.4 (part 2): how should you work through it?	Add AND/OR synthesis with a memo cache to your BDD. Try two variable orders on the same function and watch the size change.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.1.4 cracked.guide::kind::approach
