     return size
 
 
-top = svg.append('g')
-    .attr('transform', "translate(#{width/2}, #{height/2})")
-layout(top, tree)
+demo = (tree) ->
+    width = 400
+    height = 400
+
+    svg = d3.select('body').append('svg')
+        .attr('width', width)
+        .attr('height', height)
+      .append('g')
+        .attr('transform', "translate(#{width/2}, #{height/2})")
+
+    layout(svg, tree)
+
+
+demo([
+    {name: "A", children: [
+        {name: "A1", transitions: [{target: "A2"}]},
+        {name: "A2", transitions: [{target: "A3"}]},
+        {name: "A3", transitions: [{target: "A1"}]},
+    ], transitions: [{target: "B"}]},
+    {name: "B", children: [
+        {name: "B1", transitions: [{target: "B2"}]},
+        {name: "B2", transitions: [{target: "B3"}]},
+        {name: "B3", transitions: [{target: "B1"}]},
+    ], transitions: [{target: "C"}]},
+    {name: "C", children: [
+        {name: "C1", transitions: [{target: "C2"}]},
+        {name: "C2", transitions: [{target: "C3"}]},
+        {name: "C3", transitions: [{target: "C1"}]},
+    ], transitions: [{target: "A"}]},
+])
+
+
+demo([
+    {name: "A", children: [
+        {name: "B", children: [
+            {name: "C", children: [
+                {name: "D", children: [
+                    {name: "E"}
+                ]}
+            ]}
+        ]}
+    ]}
+])
+
+
+demo([
+    {name: "A", children: [
+        {name: "B1", children: [
+            {name: "C11"}
+            {name: "C12"}
+        ]}
+        {name: "B2", children: [
+            {name: "C21"}
+            {name: "C22"}
+        ]}
+    ]}
+])

        nodes.push({name: state.name})

    for state in stateList
        for tr in state.transitions
            target = stateMap[tr.target]
            links.push({source: state._idx, target: target._idx})


layout = (g, stateList) ->
    nodes = []
    links = []
