function defineDagExtremity(params) {
  return function dagExtremityImpl(selector) {
    var eles = this;
    var ret = [];

    for (var i = 0; i < eles.length; i++) {
      var ele = eles[i];

      if (!ele.isNode()) {
        continue;
      }

      var disqualified = false;
      var edges = ele.connectedEdges();

      for (var j = 0; j < edges.length; j++) {
        var edge = edges[j];
        var src = edge.source();
        var tgt = edge.target();

        if (params.noIncomingEdges && tgt === ele && src !== ele || params.noOutgoingEdges && src === ele && tgt !== ele) {
          disqualified = true;
          break;
        }
      }

      if (!disqualified) {
        ret.push(ele);
      }
    }

    return this.spawn(ret, {
      unique: true
    }).filter(selector);
  };
}
function defineDagExtremity(params) {
  return function dagExtremityImpl(selector) {
    var eles = this;
    var ret = [];

    for (var i = 0; i < eles.length; i++) {
      var ele = eles[i];

      if (!ele.isNode()) {
        continue;
      }

      var disqualified = false;
      var edges = ele.connectedEdges();

      for (var j = 0; j < edges.length; j++) {
        var edge = edges[j];
        var src = edge.source();
        var tgt = edge.target();

        if (params.noIncomingEdges && tgt === ele && src !== ele || params.noOutgoingEdges && src === ele && tgt !== ele) {
          disqualified = true;
          break;
        }
      }

      if (!disqualified) {
        ret.push(ele);
      }
    }

    return this.spawn(ret, {
      unique: true
    }).filter(selector);
  };
}
function defineDagExtremity ( params ) { return function dagExtremityImpl ( selector ) { var eles = this ; var ret = [ ] ; for ( var i = 0 ; i < eles . length ; i ++ ) { var ele = eles [ i ] ; if ( ! ele . isNode ( ) ) { continue ; } var disqualified = false ; var edges = ele . connectedEdges ( ) ; for ( var j = 0 ; j < edges . length ; j ++ ) { var edge = edges [ j ] ; var src = edge . source ( ) ; var tgt = edge . target ( ) ; if ( params . noIncomingEdges && tgt === ele && src !== ele || params . noOutgoingEdges && src === ele && tgt !== ele ) { disqualified = true ; break ; } } if ( ! disqualified ) { ret . push ( ele ) ; } } return this . spawn ( ret , { unique : true } ) . filter ( selector ) ; } ; }
DAG functions //////////////
DAG functions //////////////
defineDagExtremity - Returns a function that will return an array of nodes that are not connected to the nodes in the graph.