initAndRenderGraph(parent) {

    // make sure to destroy any previous instance
    if (this.network) {
      this._destructVis();
    }

    this.logger('info', 'Initializing and rendering the graph');

    if (!this.isInSidebar) {
      this.callbackManager.add('$:/state/sidebar', this.handleResizeEvent);
    }

    this.visOptions = this.getVisOptions();

    this.graphData = {
      nodes: new vis.DataSet(),
      edges: new vis.DataSet(),
      nodesById: utils.makeHashMap(),
      edgesById: utils.makeHashMap()
    };

    this.tooltip.setEnabled(utils.isTrue($tm.config.sys.popups.enabled, true));
    this.trace = utils.makeHashMap();
    this.network = new vis.Network(parent, this.graphData, this.visOptions);
    // after vis.Network has been instantiated, we fetch a reference to
    // the canvas element
    this.canvas = parent.getElementsByTagName('canvas')[0];
    this.networkDomNode = utils.getFirstElementByClassName('vis-network', parent, true);
    // just to be sure
    this.canvas.tabIndex = 0;

    for (let event in this.visListeners) {
      this.network.on(event, this.visListeners[event].bind(this));
    }

    this.addGraphButtons({
      'fullscreen-button': () => { this.toggleEnlargedMode('fullscreen'); },
      'halfscreen-button': () => { this.toggleEnlargedMode('halfscreen'); }
    });

    utils.setDomListeners('add', this.canvas, this.canvasDomListeners);

    this.reloadBackgroundImage();
    this.rebuildGraph({
      resetFocus: { delay: 0, duration: 0 },
    });

    this.handleResizeEvent();
    this.canvas.focus();

    if (this.isLiveView() && this.view.isEnabled('neighbourhood_trace_clicks')) {
      // directly trigger refresh so we add  currently focussed as traced node
      this.trace[utils.getText(this.refreshTriggers[0])] = true;
    }

  }
Rebuild the graph

@see http://visjs.org/docs/network.html
@see http://visjs.org/docs/dataset.html