             else
                 topNodes.push(node)
 
-    r = 40
+    for topState in tree
+        walk topState, (state) ->
+            for tr in state.transitions or []
+                links.push(
+                    source: nodeMap[state.name]
+                    target: nodeMap[tr.target]
+                )
 
     cell = svg.selectAll('.cell')
         .data(nodes)


    cell.append('text')
        .text((node) -> node.name)

    force = d3.layout.force()
        .charge(0)

    topNodes = []
    nodes = []
    nodeMap = {}
    links = []

    for topState in tree
        walk topState, (state, parent) ->
