forked from cytoscape/cytoscape.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Collection intersect
maxkfranz edited this page May 11, 2012
·
1 revision
Get the intersection of two collections.
Gets the elements that are in both
elesand incollection
collection : The collection to intersect withGets the elements that are both in
elesand in the collection built by querying the graph with the specified selector (essentially, filterseleswith the specified selector) selector : The selector to make the second collection from
If you are familiar with set theory, you will appreciate the value of this function. It allows you to get the set intersection of two collections, rather than you having to duplicate the two loop logic yourself every time you want to get what elements are in both collections.
var col1 = cy.$("[weight > 50]");
var col2 = cy.$("[weight < 55].foo");
var intersection = col1.intersect( col2 );