addon/utils/data-processor.js
function (data) {
    var dummy = DataNode.create({
          type: types.DUMMY,
          vertexName: 'dummy',
          depth: 1
        }),
        root = RootDataNode.create({
          dummy: dummy
        });

    if(!data.vertices) {
      return "Vertices not found!";
    }

    _data = _normalizeRawData(data);

    if(!_data.rootVertices.length) {
      return "Sink vertex not found!";
    }

    dummy._setChildren(centericMap(_data.rootVertices, function (vertex) {
      return _normalizeVertexTree(_treefyData(vertex, 2));
    }));

    _addOutputs(root);

    _cacheChildren(root);

    return _getGraphDetails(root);
  }
function (data) {
    var dummy = DataNode.create({
          type: types.DUMMY,
          vertexName: 'dummy',
          depth: 1
        }),
        root = RootDataNode.create({
          dummy: dummy
        });

    if(!data.vertices) {
      return "Vertices not found!";
    }

    _data = _normalizeRawData(data);

    if(!_data.rootVertices.length) {
      return "Sink vertex not found!";
    }

    dummy._setChildren(centericMap(_data.rootVertices, function (vertex) {
      return _normalizeVertexTree(_treefyData(vertex, 2));
    }));

    _addOutputs(root);

    _cacheChildren(root);

    return _getGraphDetails(root);
  }
function ( data ) { var dummy = DataNode . create ( { type : types . DUMMY , vertexName : 'dummy' , depth : 1 } ) , root = RootDataNode . create ( { dummy : dummy } ) ; if ( ! data . vertices ) { return "Vertices not found!" ; } _data = _normalizeRawData ( data ) ; if ( ! _data . rootVertices . length ) { return "Sink vertex not found!" ; } dummy . _setChildren ( centericMap ( _data . rootVertices , function ( vertex ) { return _normalizeVertexTree ( _treefyData ( vertex , 2 ) ) ; } ) ) ; _addOutputs ( root ) ; _cacheChildren ( root ) ; return _getGraphDetails ( root ) ; }
Converts raw DAG-plan into an internal data representation that graph-view,
and in turn d3.layout.tree can digest.
@param data {Object} Dag-plan data
@return {Object/String}
- Object with values tree, links, maxDepth & maxHeight
- Error message if the data was not as expected.
Converts raw DAG - plan into an internal data representation that graph - view and in turn d3 . layout . tree can digest .