eles --> Cy.Collection a collection of one or more elements (nodes and edges)

The input can be any element (node and edge) collection. http://js.cytoscape.org/#collection

interface Collection<TOut, TIn> {
    -: CollectionBuildingDifferenceFunc;
    !: CollectionBuildingDifferenceFunc;
    .: CollectionBuildingIntersectionFunc;
    (-): CollectionSymmetricDifferenceFunc;
    (+): CollectionSymmetricDifferenceFunc;
    \: CollectionBuildingDifferenceFunc;
    &: CollectionBuildingIntersectionFunc;
    ^: CollectionSymmetricDifferenceFunc;
    +: CollectionBuildingUnionFunc;
    |: CollectionBuildingUnionFunc;
    add: CollectionBuildingUnionFunc;
    and: CollectionBuildingIntersectionFunc;
    difference: CollectionBuildingDifferenceFunc;
    intersect: CollectionBuildingIntersectionFunc;
    intersection: CollectionBuildingIntersectionFunc;
    length: number;
    n: CollectionBuildingIntersectionFunc;
    not: CollectionBuildingDifferenceFunc;
    or: CollectionBuildingUnionFunc;
    relativeComplement: CollectionBuildingDifferenceFunc;
    subtract: CollectionBuildingDifferenceFunc;
    symdiff: CollectionSymmetricDifferenceFunc;
    symmetricDifference: CollectionSymmetricDifferenceFunc;
    u: CollectionBuildingUnionFunc;
    union: CollectionBuildingUnionFunc;
    xor: CollectionSymmetricDifferenceFunc;
    [iterator](): Iterator<TIn, any, any>;
    $id(id: string): TOut;
    abscomp(): CollectionReturnValue;
    absoluteComplement(): CollectionReturnValue;
    addClass(classes: ClassNames): this;
    addListener(events: string, selector: string, handler: EventHandler): this;
    addListener(events: string, handler: EventHandler): this;
    allAre(selector: string): boolean;
    allAreNeighbors(eles: CollectionArgument): boolean;
    allAreNeighbours(eles: CollectionArgument): boolean;
    animate(options: ElementAnimateOptionPos | ElementAnimateOptionRen, params?: ElementAnimateOptionsBase): this;
    anySame(eles: CollectionArgument): boolean;
    aStar(options: SearchAStarOptions): SearchAStarResult;
    attr(name?: string): any;
    attr(name: string, value: any): this;
    attr(obj: any): this;
    bellmanFord(options: SearchBellmanFordOptions): SearchBellmanFordResult;
    betweennessCentrality(options: SearchBetweennessOptions): SearchBetweennessResult;
    bfs(options: SearchFirstOptions): SearchFirstResult;
    bind(events: string, selector: string, handler: EventHandler): this;
    bind(events: string, handler: EventHandler): this;
    boundingbox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
    boundingBox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
    breadthFirstSearch(options: SearchFirstOptions): SearchFirstResult;
    classes(classes: ClassNames): this;
    classes(classes: undefined | ClassNames): string[] | Collection<TOut, TIn>;
    classes(): string[];
    clearQueue(): this;
    clone(): CollectionReturnValue;
    closedNeighborhood(selector?: string): CollectionReturnValue;
    closenessCentrality(options: SearchClosenessCentralityOptions): number;
    closenessCentralityNormalized(options: SearchClosenessCentralityNormalizedOptions): SearchDegreeCentralityNormalizedResultUndirected | SearchDegreeCentralityNormalizedResultDirected;
    complement(): CollectionReturnValue;
    components(): CollectionReturnValue[];
    contains(eles: CollectionArgument): boolean;
    copy(): CollectionReturnValue;
    createLayout(options: LayoutOptions): Layouts;
    css(name: string, value: any): this;
    css(name: string): any;
    css(obj: object): this;
    css(): {
        [index: string]: any;
    };
    data(name?: string): any;
    data(name: string, value: any): this;
    data(obj: any): this;
    degreeCentrality(options: SearchDegreeCentralityOptions): SearchDegreeCentralityResultUndirected | SearchDegreeCentralityResultDirected;
    degreeCentralityNormalized(options: SearchDegreeCentralityNormalizedOptions): SearchDegreeCentralityNormalizedResultUndirected | SearchDegreeCentralityNormalizedResultDirected;
    delay(duration: number, complete?: (() => void)): this;
    depthFirstSearch(options: SearchFirstOptions): SearchFirstResult;
    deselect(): this;
    dfs(options: SearchFirstOptions): SearchFirstResult;
    diff(selector: string | CollectionArgument): {
        both: CollectionReturnValue;
        left: CollectionReturnValue;
        right: CollectionReturnValue;
    };
    dijkstra(options: SearchDijkstraOptions): SearchDijkstraResult;
    each(each: ((ele: TOut, i: number, eles: this) => boolean | void), thisArg?: any): this;
    edges(selector?: string): cytoscape.EdgeCollection;
    emit(events: string, extra?: unknown[]): this;
    empty(): boolean;
    eq(index: number): TIn;
    every(test: ((ele: CollectionArgument, i: number, eles: CollectionArgument) => boolean), thisArg?: any): boolean;
    filter(selector: string | ((ele: TIn, i: number, eles: CollectionArgument) => boolean)): CollectionReturnValue;
    first(): TIn;
    flashClass(classes: ClassNames, duration?: number): this;
    floydWarshall(options: SearchFloydWarshallOptions): SearchFloydWarshallResult;
    forEach(each: ((ele: TOut, i: number, eles: this) => boolean | void), thisArg?: any): this;
    getElementById(id: string): TOut;
    has(eles: CollectionArgument): boolean;
    hopcroftTarjanBiconnected(): {
        components: CollectionReturnValue;
        cut: cytoscape.NodeCollection;
    };
    hopcroftTarjanBiconnectedComponents(): {
        components: CollectionReturnValue;
        cut: cytoscape.NodeCollection;
    };
    htb(): {
        components: CollectionReturnValue;
        cut: cytoscape.NodeCollection;
    };
    htbc(): {
        components: CollectionReturnValue;
        cut: cytoscape.NodeCollection;
    };
    is(selector: string): boolean;
    jsons(): string[];
    kargerStein(): {
        components: CollectionReturnValue;
        cut: cytoscape.EdgeCollection;
        partitionFirst: cytoscape.NodeCollection;
        partitionSecond: cytoscape.NodeCollection;
    };
    kruskal(handler: ((edge: cytoscape.EdgeCollection) => number)): CollectionReturnValue;
    last(): TIn;
    layout(options: LayoutOptions): Layouts;
    listen(events: string, selector: string, handler: EventHandler): this;
    listen(events: string, handler: EventHandler): this;
    makeLayout(options: LayoutOptions): Layouts;
    map<T>(fn: ((ele: TIn, i: number, eles: CollectionArgument) => T), thisArg?: any): T[];
    max<T>(fn: ((ele: TIn, i: number, eles: CollectionArgument) => T), thisArg?: any): {
        ele: SingularElementReturnValue;
        value: T;
    };
    merge(eles: string | CollectionArgument): this;
    min<T>(fn: ((ele: TIn, i: number, eles: CollectionArgument) => T), thisArg?: any): {
        ele: SingularElementReturnValue;
        value: T;
    };
    move(location: {
        source?: string;
        target?: string;
    }): cytoscape.EdgeCollection;
    move(location: {
        parent: null | string;
    }): cytoscape.NodeCollection;
    neighborhood(selector?: string): CollectionReturnValue;
    nodes(selector?: string): cytoscape.NodeCollection;
    nonempty(): boolean;
    off(events: string, selector?: string, handler?: EventHandler): this;
    on(events: string, selector: string, handler: EventHandler): this;
    on(events: string, handler: EventHandler): this;
    once(events: string, selector: string, data: any, handler: EventHandler): this;
    once(events: string, selector: string, handler: EventHandler): this;
    once(events: string, handler: EventHandler): this;
    one(events: string, selector: string, data: any, handler: EventHandler): this;
    one(events: string, selector: string, handler: EventHandler): this;
    one(events: string, handler: EventHandler): this;
    openNeighborhood(selector?: string): CollectionReturnValue;
    pageRank(options: SearchPageRankOptions): SearchPageRankResult;
    pon(events: string, selector?: string): Promise<EventHandler>;
    promiseOn(events: string, selector?: string): Promise<EventHandler>;
    reduce<T>(fn: ((prevVal: T, ele: TIn, i: number, eles: CollectionArgument) => T), initialValue: T): T;
    remove(): CollectionReturnValue;
    removeAllListeners(): this;
    removeAttr(names?: string): CollectionReturnValue;
    removeClass(classes: ClassNames): this;
    removeData(names?: string): CollectionReturnValue;
    removeListener(events: string, selector?: string, handler?: EventHandler): this;
    removeStyle(names?: string): this;
    renderedBoundingbox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
    renderedBoundingBox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
    restore(): CollectionReturnValue;
    same(eles: CollectionArgument): boolean;
    select(): this;
    selectify(): this;
    size(): number;
    slice(start?: number, end?: number): this;
    some(test: ((ele: CollectionArgument, i: number, eles: CollectionArgument) => boolean), thisArg?: any): boolean;
    sort(sort: ((ele1: TIn, ele2: TIn) => number)): CollectionReturnValue;
    stop(clearQueue?: boolean, jumpToEnd?: boolean): this;
    style(name: string, value: any): this;
    style(name: string): any;
    style(obj: object): this;
    style(): {
        [index: string]: any;
    };
    tarjanStronglyConnected(): {
        components: CollectionReturnValue;
        cut: cytoscape.EdgeCollection;
    };
    tarjanStronglyConnectedComponents(): {
        components: CollectionReturnValue;
        cut: cytoscape.EdgeCollection;
    };
    toArray(): TIn[];
    toggleClass(classes: ClassNames, toggle?: boolean): this;
    trigger(events: string, extra?: unknown[]): this;
    tsc(): {
        components: CollectionReturnValue;
        cut: cytoscape.EdgeCollection;
    };
    tscc(): {
        components: CollectionReturnValue;
        cut: cytoscape.EdgeCollection;
    };
    unbind(events: string, selector?: string, handler?: EventHandler): this;
    unlisten(events: string, selector?: string, handler?: EventHandler): this;
    unmerge(eles: string | CollectionArgument): this;
    unselect(): this;
    unselectify(): this;
}

Type Parameters

Hierarchy (view full)

Properties

Get a new collection, resulting from the collection without some specified elements. http://js.cytoscape.org/#eles.difference

Get the elements in both this collection and another specified collection. http://js.cytoscape.org/#eles.intersection

length: number

Get the number of elements in the collection.

Get the elements that are in the calling collection or the passed collection but not in both. http://js.cytoscape.org/#eles.symmetricDifference

Get a new collection, resulting from adding the collection with another one http://js.cytoscape.org/#eles.union

Methods

  • Iterate over the elements in the collection using an implementation like the native array function namesake.

    This function behaves like Array.prototype.forEach() with minor changes for convenience: You can exit the iteration early by returning false in the iterating function. The Array.prototype.forEach() implementation does not support this, but it is included anyway on account of its utility.

    Parameters

    • each: ((ele: TOut, i: number, eles: this) => boolean | void)

      The function executed each iteration. ele - The current element. i - The index of the current element. eles - The collection of elements being iterated.

        • (ele, i, eles): boolean | void
        • Parameters

          • ele: TOut
          • i: number
          • eles: this

          Returns boolean | void

    • OptionalthisArg: any

      [optional] The value for this within the iterating function.

    Returns this

  • Perform a in-place merge of the given elements into the calling collection.

    Parameters

    • eles: string | CollectionArgument

      The elements to merge in-place or a selector representing the elements to merge. All elements in the graph matching the selector are used as the passed collection.

      This function modifies the calling collection instead of returning a new one. Use of this function should be considered for performance in some cases, but otherwise should be avoided. Consider using eles.union() instead. Use this function only on new collections that you create yourself, using cy.collection(). This ensures that you do not unintentionally modify another collection.

      Examples With a collection:

    Returns this

    var col = cy.collection(); // new, empty collection
    var j = cy.$('#j');
    var e = cy.$('#e');
    col.merge( j ).merge( e );

    With a selector:
    var col = cy.collection(); // new, empty collection
    col.merge('#j').merge('#e');
  • Get the open neighbourhood of the elements.

    The neighbourhood returned by this function is a bit different than the traditional definition of a "neighbourhood": This returned neighbourhood includes the edges connecting the collection to the neighbourhood. This gives you more flexibility. An open neighbourhood is one that does not include the original set of elements. If unspecified, a neighbourhood is open by default.

    Parameters

    • Optionalselector: string

      [optional] An optional selector that is used to filter the resultant collection.

    Returns CollectionReturnValue

  • Get the open neighbourhood of the elements.

    The neighbourhood returned by this function is a bit different than the traditional definition of a "neighbourhood": This returned neighbourhood includes the edges connecting the collection to the neighbourhood. This gives you more flexibility. An open neighbourhood is one that does not include the original set of elements. If unspecified, a neighbourhood is open by default.

    Parameters

    • Optionalselector: string

      [optional] An optional selector that is used to filter the resultant collection.

    Returns CollectionReturnValue

  • Get a subset of the elements in the collection based on specified indices.

    Parameters

    • Optionalstart: number

      [optional] An integer that specifies where to start the selection. The first element has an index of 0. Use negative numbers to select from the end of an array.

    • Optionalend: number

      [optional] An integer that specifies where to end the selection. If omitted, all elements from the start position and to the end of the array will be selected. Use negative numbers to select from the end of an array.

    Returns this

  • Perform an in-place operation on the calling collection to remove the given elements.

    Parameters

    • eles: string | CollectionArgument

      The elements to remove in-place or a selector representing the elements to remove . All elements in the graph matching the selector are used as the passed collection.

      This function modifies the calling collection instead of returning a new one. Use of this function should be considered for performance in some cases, but otherwise should be avoided. Consider using eles.filter() or eles.remove() instead. Use this function only on new collections that you create yourself, using cy.collection(). This ensures that you do not unintentionally modify another collection.

      Examples With a collection:

    Returns this

    var col = cy.collection(); // new, empty collection
    var e = cy.$('#e');
    col.merge( cy.nodes() );
    col.unmerge( e );

    With a selector:
    var col = cy.collection(); // new, empty collection
    col.merge( cy.nodes() );
    col.unmerge('#e');
MMNEPVFCICPMFPCPTTAAATR