static/js/org/cytoscape.js
function( selector ){
      var eles = this;
      var roots = [];
      for( var i = 0; i < eles.length; i++ ){
        var ele = eles[i];
        if( !ele.isNode() ){
          continue;
        }

        var hasEdgesPointingIn = ele.connectedEdges('[target = "' + ele.id() + '"][source != "' + ele.id() + '"]').length > 0;

        if( !hasEdgesPointingIn ){
          roots.push( ele );
        }
      }

      return new $$.Collection( this._private.cy, roots ).filter( selector );
    }
function( selector ){
      var eles = this;
      var roots = [];
      for( var i = 0; i < eles.length; i++ ){
        var ele = eles[i];
        if( !ele.isNode() ){
          continue;
        }

        var hasEdgesPointingIn = ele.connectedEdges('[target = "' + ele.id() + '"][source != "' + ele.id() + '"]').length > 0;

        if( !hasEdgesPointingIn ){
          roots.push( ele );
        }
      }

      return new $$.Collection( this._private.cy, roots ).filter( selector );
    }
function ( selector ) { var eles = this ; var roots = [ ] ; for ( var i = 0 ; i < eles . length ; i ++ ) { var ele = eles [ i ] ; if ( ! ele . isNode ( ) ) { continue ; } var hasEdgesPointingIn = ele . connectedEdges ( '[target = "' + ele . id ( ) + '"][source != "' + ele . id ( ) + '"]' ) . length > 0 ; if ( ! hasEdgesPointingIn ) { roots . push ( ele ) ; } } return new $$ . Collection ( this . _private . cy , roots ) . filter ( selector ) ; }
get the root nodes in the DAG
get the root nodes in the DAG