src/classes/sigma.classes.graph.js
function(settings) {
    var k,
        fn,
        data;

    /**
     * DATA:
     * *****
     * Every data that is callable from graph methods are stored in this "data"
     * object. This object will be served as context for all these methods,
     * and it is possible to add other type of data in it.
     */
    data = {
      /**
       * SETTINGS FUNCTION:
       * ******************
       */
      settings: settings || _defaultSettingsFunction,

      /**
       * MAIN DATA:
       * **********
       */
      nodesArray: [],
      edgesArray: [],

      /**
       * GLOBAL INDEXES:
       * ***************
       * These indexes just index data by ids.
       */
      nodesIndex: Object.create(null),
      edgesIndex: Object.create(null),

      /**
       * LOCAL INDEXES:
       * **************
       * These indexes refer from node to nodes. Each key is an id, and each
       * value is the array of the ids of related nodes.
       */
      inNeighborsIndex: Object.create(null),
      outNeighborsIndex: Object.create(null),
      allNeighborsIndex: Object.create(null),

      inNeighborsCount: Object.create(null),
      outNeighborsCount: Object.create(null),
      allNeighborsCount: Object.create(null)
    };

    // Execute bindings:
    for (k in _initBindings)
      _initBindings[k].call(data);

    // Add methods to both the scope and the data objects:
    for (k in _methods) {
      fn = __bindGraphMethod(k, data, _methods[k]);
      this[k] = fn;
      data[k] = fn;
    }
  }
function(settings) {
    var k,
        fn,
        data;

    /**
     * DATA:
     * *****
     * Every data that is callable from graph methods are stored in this "data"
     * object. This object will be served as context for all these methods,
     * and it is possible to add other type of data in it.
     */
    data = {
      /**
       * SETTINGS FUNCTION:
       * ******************
       */
      settings: settings || _defaultSettingsFunction,

      /**
       * MAIN DATA:
       * **********
       */
      nodesArray: [],
      edgesArray: [],

      /**
       * GLOBAL INDEXES:
       * ***************
       * These indexes just index data by ids.
       */
      nodesIndex: Object.create(null),
      edgesIndex: Object.create(null),

      /**
       * LOCAL INDEXES:
       * **************
       * These indexes refer from node to nodes. Each key is an id, and each
       * value is the array of the ids of related nodes.
       */
      inNeighborsIndex: Object.create(null),
      outNeighborsIndex: Object.create(null),
      allNeighborsIndex: Object.create(null),

      inNeighborsCount: Object.create(null),
      outNeighborsCount: Object.create(null),
      allNeighborsCount: Object.create(null)
    };

    // Execute bindings:
    for (k in _initBindings)
      _initBindings[k].call(data);

    // Add methods to both the scope and the data objects:
    for (k in _methods) {
      fn = __bindGraphMethod(k, data, _methods[k]);
      this[k] = fn;
      data[k] = fn;
    }
  }
function ( settings ) { var k , fn , data ; /**
     * DATA:
     * *****
     * Every data that is callable from graph methods are stored in this "data"
     * object. This object will be served as context for all these methods,
     * and it is possible to add other type of data in it.
     */ data = { /**
       * SETTINGS FUNCTION:
       * ******************
       */ settings : settings || _defaultSettingsFunction , /**
       * MAIN DATA:
       * **********
       */ nodesArray : [ ] , edgesArray : [ ] , /**
       * GLOBAL INDEXES:
       * ***************
       * These indexes just index data by ids.
       */ nodesIndex : Object . create ( null ) , edgesIndex : Object . create ( null ) , /**
       * LOCAL INDEXES:
       * **************
       * These indexes refer from node to nodes. Each key is an id, and each
       * value is the array of the ids of related nodes.
       */ inNeighborsIndex : Object . create ( null ) , outNeighborsIndex : Object . create ( null ) , allNeighborsIndex : Object . create ( null ) , inNeighborsCount : Object . create ( null ) , outNeighborsCount : Object . create ( null ) , allNeighborsCount : Object . create ( null ) } ; // Execute bindings: for ( k in _initBindings ) _initBindings [ k ] . call ( data ) ; // Add methods to both the scope and the data objects: for ( k in _methods ) { fn = __bindGraphMethod ( k , data , _methods [ k ] ) ; this [ k ] = fn ; data [ k ] = fn ; } }
The graph constructor. It initializes the data and the indexes, and binds
the custom indexes and methods to its own scope.

Recognized parameters:
**********************
Here is the exhaustive list of every accepted parameters in the settings
object:

{boolean} clone     Indicates if the data have to be cloned in methods
to add nodes or edges.
{boolean} immutable Indicates if nodes "id" values and edges "id",
"source" and "target" values must be set as
immutable.

@param  {?configurable} settings Eventually a settings function.
@return {graph}                  The new graph instance.
The graph constructor . It initializes the data and the indexes and binds the custom indexes and methods to its own scope .