lib/build-graph.js
function collectNodeIds(stmt) {
  var ids = {},
      stack = [],
      curr;

  var push = stack.push.bind(stack);

  push(stmt);
  while(stack.length) {
    curr = stack.pop();
    switch(curr.type) {
      case "node": ids[curr.id] = true; break;
      case "edge": _.each(curr.elems, push); break;
      case "subgraph": _.each(curr.stmts, push); break;
    }
  }

  return _.keys(ids);
}
function collectNodeIds(stmt) {
  var ids = {},
      stack = [],
      curr;

  var push = stack.push.bind(stack);

  push(stmt);
  while(stack.length) {
    curr = stack.pop();
    switch(curr.type) {
      case "node": ids[curr.id] = true; break;
      case "edge": _.each(curr.elems, push); break;
      case "subgraph": _.each(curr.stmts, push); break;
    }
  }

  return _.keys(ids);
}
function collectNodeIds ( stmt ) { var ids = { } , stack = [ ] , curr ; var push = stack . push . bind ( stack ) ; push ( stmt ) ; while ( stack . length ) { curr = stack . pop ( ) ; switch ( curr . type ) { case "node" : ids [ curr . id ] = true ; break ; case "edge" : _ . each ( curr . elems , push ) ; break ; case "subgraph" : _ . each ( curr . stmts , push ) ; break ; } } return _ . keys ( ids ) ; }
Collect all nodes involved in a subgraph statement
Collect all nodes involved in a subgraph statement