     edges[node_id] = _(edge_labels).map (label) ->
       { label: label, dest: dotty.get(data, label).$oid }
 
+was_seen = (node_id) ->
+  _.some _.values(collections).concat([default_collection]), (c) ->
+    _.contains c.nodes, node_id
+
 process.stdin.pipe(JSONStream.parse()).on 'data', (data) ->
   # sometimes we get piped arrays, sometimes we get one json obj per line
   if _(data).isArray()

  '#7f8c8d'
]

stream = process.stdout
stream.write   """
  digraph {

handle_data = (data) ->
  # all nodes keyed on objectid
  node_id = data._id.$oid
  node_label = data.__label or node_id

  if data.__collection?
    collections[data.__collection] ?= {fillcolor: rnd_color(), nodes: []}
    collections[data.__collection].nodes.push node_id
    node_color = collections[data.__collection].fillcolor
  else
    default_collection.nodes.push node_id
    node_color = default_collection.fillcolor
  colors[node_id] = node_color

  # create/label/fill the node
