lib/iterators/vertexIterator.js
function VertexIterator(graph, startFrom) {
  if (graph === undefined) {
    throw new Error('Graph is required by VertexIterator');
  }

  this._graph = graph;
  this._startFrom = startFrom;
  this._currentIndex = 0;
  this._allNodes = [];
  this._initialized = false;
  this._current = undefined;
}
function VertexIterator(graph, startFrom) {
  if (graph === undefined) {
    throw new Error('Graph is required by VertexIterator');
  }

  this._graph = graph;
  this._startFrom = startFrom;
  this._currentIndex = 0;
  this._allNodes = [];
  this._initialized = false;
  this._current = undefined;
}
function VertexIterator ( graph , startFrom ) { if ( graph === undefined ) { throw new Error ( 'Graph is required by VertexIterator' ) ; } this . _graph = graph ; this . _startFrom = startFrom ; this . _currentIndex = 0 ; this . _allNodes = [ ] ; this . _initialized = false ; this . _current = undefined ; }
Vertex Iterator provides a simple wrapper over `graph.forEachNode`
to perform lazy iteration.

`startFrom` argument is optional and has the following meaning:

_Not passed_ - Iterate over all vertices of a `graph`:
```
var iterator = new VertexIterator(graph);

while (iterator.moveNext()) {
// prints all vertices:
console.log(iterator.current());
}
```

_Array_ - Iterate over all vertices with matching identifiers from array:
```
var iterator = new VertexIterator(graph, [0, 1]);

while (iterator.moveNext()) {
// prints two vertices with identifier 0 or 1:
console.log(iterator.current());
}
```

_Function_ - Iterate over all vertices which match function predicate:
```
var filter = function (vertex) { return false; },
iterator = new VertexIterator(graph, filter);

while (iterator.moveNext()) {
console.log('This will never be shown');
}
```

_Anything else_ - Consider it as starting vertex id:
```
var iterator = new VertexIterator(graph, 42);

while (iterator.moveNext()) {
// this will print single node with id == 42;
console.log(iterator.current());
}
```
Vertex Iterator provides a simple wrapper over graph . forEachNode to perform lazy iteration .