| rule Tree2Node | |
| transform t : Tree!Tree | |
| to n : Graph!Node { | |
| n.name = t.label; | |
| // If t is not the top tree | |
| // create an edge connecting n | |
| // with the Node created from t's parent | |
| if (t.parent.isDefined()) { | |
| var e : new Graph!Edge; | |
| e.source ::= t.parent; | |
| e.target = n; | |
| } | |
| } |