traverse.js
function widthTraverse (graph, reachable, start, depth, hops, iter) {
  if(!start)
    throw new Error('Graphmitter#traverse: start must be provided')

  //var nodes = 1

  reachable[start] = reachable[start] == null ? 0 : reachable[start]

  var queue = [start] //{key: start, hops: depth}]
  iter = iter || function () {}
  while(queue.length) {
    var o = queue.shift()
    var h = reachable[o]
    var node = graph[o]
    if(node && (!hops || (h + 1 <= hops)))
      for(var k in node) {
        // If we have already been to this node by a shorter path,
        // then skip this node (this only happens when processing
        // a realtime edge)
        if(!(reachable[k] != null && reachable[k] < h + 1)) {
          if(false === iter(o, k, h + 1, reachable[k]))
            return reachable

          reachable[k] = h + 1
//          nodes ++
          queue.push(k)
        }
    }
  }

  return reachable
}
function widthTraverse (graph, reachable, start, depth, hops, iter) {
  if(!start)
    throw new Error('Graphmitter#traverse: start must be provided')

  //var nodes = 1

  reachable[start] = reachable[start] == null ? 0 : reachable[start]

  var queue = [start] //{key: start, hops: depth}]
  iter = iter || function () {}
  while(queue.length) {
    var o = queue.shift()
    var h = reachable[o]
    var node = graph[o]
    if(node && (!hops || (h + 1 <= hops)))
      for(var k in node) {
        // If we have already been to this node by a shorter path,
        // then skip this node (this only happens when processing
        // a realtime edge)
        if(!(reachable[k] != null && reachable[k] < h + 1)) {
          if(false === iter(o, k, h + 1, reachable[k]))
            return reachable

          reachable[k] = h + 1
//          nodes ++
          queue.push(k)
        }
    }
  }

  return reachable
}
function widthTraverse ( graph , reachable , start , depth , hops , iter ) { if ( ! start ) throw new Error ( 'Graphmitter#traverse: start must be provided' ) //var nodes = 1 reachable [ start ] = reachable [ start ] == null ? 0 : reachable [ start ] var queue = [ start ] //{key: start, hops: depth}] iter = iter || function ( ) { } while ( queue . length ) { var o = queue . shift ( ) var h = reachable [ o ] var node = graph [ o ] if ( node && ( ! hops || ( h + 1 <= hops ) ) ) for ( var k in node ) { // If we have already been to this node by a shorter path, // then skip this node (this only happens when processing // a realtime edge) if ( ! ( reachable [ k ] != null && reachable [ k ] < h + 1 ) ) { if ( false === iter ( o , k , h + 1 , reachable [ k ] ) ) return reachable reachable [ k ] = h + 1 //          nodes ++ queue . push ( k ) } } } return reachable }
mutates `reachable`, btw
mutates reachable btw