{
   "code" : "(\r\nvar labels = \"\", links = \"\", i = 0;\r\n\r\nvar doDict = { |x, func|\r\n\tif(x.isKindOf(Dictionary)) {\r\n\t\tx.keysValuesDo { |key, val| func.value(val, i, key) }\r\n\t} {\r\n\t\tx.do(func)\r\n\t}\r\n};\r\n\r\nvar addNode = { |i, j, key, label = \"\"|\r\n\tlabels = labels ++ \"\\n% [label=\\\"%\\\"]\".format(i, label);\r\n\tlinks = links ++ \"\\n% -> %\".format(j, i);\r\n\tif(key.notNil) { links = links ++ \" [label=\\\"%\\\"; fontname=Courier]\".format(key) };\r\n};\r\n\r\nf = { |coll|\r\n\tvar j = i, str;\r\n\tdoDict.(coll, { |x, k, key|\r\n\t\ti = i + 1;\r\n\t\tif(x.isCollection) {\r\n\t\t\taddNode.(i, j, key, \"\");\r\n\t\t\tf.(x);\r\n\t\t} {\r\n\t\t\taddNode.(i, j, key, x.cs);\r\n\t\t}\r\n\t});\r\n\tstr = \"\\n\\ndigraph {\\n\" ++ labels ++ \"\\n\" ++ links ++ \"\\n}\";\r\n};\r\n\r\n)\r\n\r\nf.([1, 2, 3, [2, 3, [1, 2, 3]]];);\r\nf.([1, 2, 3, [2, (a: 3, b: [9, 2], c: { 2 + 3 }), [1, 2, 3]]];);",
   "is_private" : null,
   "id" : "1-4Zo",
   "labels" : [
      "arrays",
      "dot",
      "nested"
   ],
   "description" : "Displays a tree from nested arrays for graphviz",
   "ancestor_list" : [],
   "name" : "convert arrays to graphviz dot format",
   "author" : "julian.rohrhuber"
}
