Given:
Tree
, 
Want:
Give poly-time algorithm for finding max weight matching
Solve:
cost of max weight matching for sub-tree rooted at root.
Base case:
when
is a leaf node- for internal node:
- case 1:
is unmatched - case 2:
is matched to one of its children
First, look at a sub-tree from
, 

Case 1: when
is not matched
, this means its children must all match to some of their children. Look at the thick edges.

Case 2: when
is matched to
so
![Rendered by QuickLaTeX.com A[u]=max\{\text{case 1}+\text{case 2}+\text{case 3}\}](http://cassiechen.com/wp-content/ql-cache/quicklatex.com-3b2f8c2f9894f7cd0ba1aaa0d3be852a_l3.png)
![Rendered by QuickLaTeX.com A[u]=max\{w(u,v)+\sum_{x\text{ child of }u\text{ when }x \neq v} A[x]+\sum_{w\text{ child of }v}A[w]\}](http://cassiechen.com/wp-content/ql-cache/quicklatex.com-669d2648243918eccd15f80542493fb5_l3.png)

Sum up: answer is at
.
![Rendered by QuickLaTeX.com A[u] = max \left\{ \begin{array}{cc} \sum\limits_{v\text{ child of }u}A[v]\\ \\ max\{w(u,v)+\sum\limits_{x\text{ child of }u\text{ when }x \neq v} A[x]+\sum\limits_{w\text{ child of }v}A[w]\} \end{array} \right.](http://cassiechen.com/wp-content/ql-cache/quicklatex.com-368f49f7e2e6969dcf2a7a06804240e8_l3.png)
Running time:
![Rendered by QuickLaTeX.com A[u] = max \left\{ \begin{array}{cc} O(degree(u))\\ O(c^2) \end{array} \right.](http://cassiechen.com/wp-content/ql-cache/quicklatex.com-c393d5e20b7b380b37e61adce7619cac_l3.png)
where
means how many children a certain node has.
Number of states: 
each state take
.
so:


full of useful tips for those who are actually interested in this subject, particularly this very post