     collections[data.__collection] ?= {fillcolor: rnd_color(), nodes: []}
     collections[data.__collection].nodes.push node_id
     node_color = collections[data.__collection].fillcolor
-  colors[node_id] = node_color
 
   # create/label/fill the node
   stream.write "  \"#{node_id}\" [label=\"#{node_label}\", fillcolor=\"#{node_color}\", penwidth=0, fontname=\"helvetica\", fontcolor=white];\n"

    .value()
  if edge_labels.length
    edges[node_id] = _(edge_labels).map (label) ->
      { label: label, dest: dotty.get(data, label).$oid }

process.stdin.pipe(JSONStream.parse()).on 'data', (data) ->
  # sometimes we get piped arrays, sometimes we get one json obj per line

  # draw edges
  for source, edgeinfos of edges
    for edge in edgeinfos
      stream.write "  \"#{source}\" -> \"#{edge.dest}\" [style=solid, label=\"#{edge.label}\", color=\"#{edge.color}\", fontcolor=\"#{edge.color}\"];\n"

  # group together nodes in the same collection
  for cname, cinfo of collections
