I have a sort of a one level tree structure as:

![alt text](https://i.stack.imgur.com/fEXEn.png)

Where p are parent nodes, c are child nodes and b are *hypothetical* branches.

I want to find all **combinations** of branches under the constraint that only *one* parent can branch to only *one* child node, and two branches can not share parent and/or child.

E.g. if `combo` is the set of combinations:

```
combo[0] = [b[0], b[3]]
combo[1] = [b[0], b[4]]
combo[2] = [b[1], b[4]]
combo[3] = [b[2], b[3]]

```

I think that's all of them. =)

How can this be achived automaticly in Python for arbitrary trees of this structures i.e. the number of p:s, c:s and b:s are arbitrary.

EDIT:

It is not a tree but rather a [bipartite](http://en.wikipedia.org/wiki/Bipartite_graph) [directed acyclic graph](http://en.wikipedia.org/wiki/Directed_acyclic_graph)