{ "fnArgLinks": { "selector": "#selectors", "event": "#events", "events": "#events", "eleObj": "#notation/elements-json", "eleObjs": "#notation/elements-json", "elesArray": "#notation/elements-json", "elesJson": "#notation/elements-json", "eleJson": "#notation/elements-json", "ele": "#collection", "eles": "#collection", "root": "#collection", "roots": "#collection", "position": "#notation/position", "pos": "#notation/position", "renderedPosition": "#notation/position", "pan": "#notation/position", "panBy": "#notation/position", "css": "#style", "style": "#style", "stylesheet": "#style", "easing": "#style/transition-animation", "cyJson": "#core/initialisation" }, "mdRunButtonBlocked": [ "intro.md", "notation.md", "getting-started.md", "core/init.md" ], "sections": [ { "md": "links" }, { "name": "Demos", "md": "demos", "demos": [ { "name": "FCOSE gene-gene graph", "id": "fcose-gene" }, { "name": "Tokyo railways", "id": "tokyo-railways" }, { "name": "Wine & cheese", "id": "wine-cheese-map", "github": "cytoscape/wineandcheesemap", "viewUrl": "http://wineandcheesemap.com" }, { "name": "SBGN stylesheet", "id": "sbgn-stylesheet", "github": "PathwayCommons/cytoscape-sbgn-stylesheet" }, { "name": "Popper.js extension", "id": "popper", "github": "cytoscape/cytoscape.js-popper" }, { "name": "Popper.js extension & Tippy.js tooltips", "id": "popper-tippy", "github": "cytoscape/cytoscape.js-popper", "viewUrl": "https://cytoscape.github.io/cytoscape.js-popper/demo-tippy.html" }, { "name": "Automove extension", "id": "automove", "github": "cytoscape/cytoscape.js-automove" }, { "name": "Cxtmenu extension", "id": "cxtmenu", "github": "cytoscape/cytoscape.js-cxtmenu" }, { "name": "Edgehandles extension", "id": "edgehandles", "github": "cytoscape/cytoscape.js-edgehandles", "viewUrl": "https://cytoscape.org/cytoscape.js-edgehandles/demo-snap.html" }, { "name": "Compound drag-and-drop extension", "id": "compound-drag-and-drop", "github": "cytoscape/cytoscape.js-compound-drag-and-drop" }, { "name": "Circle layout", "id": "circle-layout" }, { "name": "Concentric layout", "id": "concentric-layout" }, { "name": "AVSDF layout", "id": "avsdf-layout", "github": "iVis-at-Bilkent/cytoscape.js-avsdf", "viewUrl": "https://ivis-at-bilkent.github.io/cytoscape.js-avsdf/demo.html" }, { "name": "CiSE layout", "id": "cise-layout", "github": "iVis-at-Bilkent/cytoscape.js-cise", "viewUrl": "https://ivis-at-bilkent.github.io/cytoscape.js-cise/demo/demo.html" }, { "name": "Grid layout", "id": "grid-layout" }, { "name": "CoSE layout", "id": "cose-layout" }, { "name": "CoSE Bilkent layout", "id": "cose-bilkent-layout", "github": "cytoscape/cytoscape.js-cose-bilkent" }, { "name": "CoSE Bilkent layout (compound)", "id": "cose-bilkent-layout-compound", "github": "cytoscape/cytoscape.js-cose-bilkent", "viewUrl": "https://cytoscape.github.io/cytoscape.js-cose-bilkent/demo-compound.html" }, { "name": "fCoSE layout", "id": "fcose-layout", "github": "iVis-at-Bilkent/cytoscape.js-fcose", "viewUrl": "https://ivis-at-bilkent.github.io/cytoscape.js-fcose/demo/demo.html" }, { "name": "fCoSE layout (compound)", "id": "fcose-layout-compound", "github": "iVis-at-Bilkent/cytoscape.js-fcose", "viewUrl": "https://ivis-at-bilkent.github.io/cytoscape.js-fcose/demo/demo-compound.html" }, { "name": "fCoSE layout (constraint)", "id": "fcose-layout-constraint", "github": "iVis-at-Bilkent/cytoscape.js-fcose", "viewUrl": "https://ivis-at-bilkent.github.io/cytoscape.js-fcose/demo/demo-constraint.html" }, { "name": "Cola layout", "id": "cola-layout", "github": "cytoscape/cytoscape.js-cola" }, { "name": "Cola layout (compound)", "id": "cola-layout-compound", "github": "cytoscape/cytoscape.js-cola", "viewUrl": "https://cytoscape.github.io/cytoscape.js-cola/demo-compound.html" }, { "name": "ELK layout", "id": "elk-layout", "github": "cytoscape/cytoscape.js-elk", "viewUrl": "https://cytoscape.github.io/cytoscape.js-elk/?demo=layered" }, { "name": "Dagre layout", "id": "dagre-layout", "github": "cytoscape/cytoscape.js-dagre" }, { "name": "Klay layout", "id": "klay-layout", "github": "cytoscape/cytoscape.js-klay" }, { "name": "Breadthfirst layout & images", "id": "images-breadthfirst-layout" }, { "name": "Animated BFS", "id": "animated-bfs" }, { "name": "Node types", "id": "node-types" }, { "name": "Edge types", "id": "edge-types" }, { "name": "Radius types", "id": "radius-types" }, { "name": "Edge arrow types", "id": "edge-arrows" }, { "name": "Labels", "id": "labels" }, { "name": "Compound nodes", "id": "compound-nodes" }, { "name": "Linkout example", "id": "linkout-example" } ], "disabledDemos": [ { "name": "Multiple instances", "id": "multiple-instances" }, { "name": "Visual style", "id": "visual-style" }, { "name": "Initialisation", "id": "initialisation" }, { "name": "Multiple windows", "id": "multiple-windows" } ] }, { "name": "Introduction", "mdTemplate": "intro"}, { "name": "Notation", "md": "notation" }, { "name": "Getting started", "md": "getting-started" }, { "name": "Core", "md": "core/core", "sections": [ { "name": "Initialisation", "md": "core/init" }, { "name": "Graph manipulation", "fns": [ { "name": "cy.add", "descr": "Add elements to the graph and return them.", "formats": [ { "descr": "Add a specified element to the graph.", "args": [ { "name": "eleObj", "descr": "A plain object that specifies the element." } ] }, { "descr": "Add the specified elements to the graph.", "args": [ { "name": "eleObjs", "descr": "An array of elements specified by plain objects." } ] }, { "descr": "Add the specified elements to the graph.", "args": [ { "name": "eles", "descr": "A collection of elements." } ] } ], "md": "core/add" }, { "name": "cy.remove", "descr": "Remove elements from the graph and return them.", "formats": [ { "descr": "Remove the specified elements.", "args": [ { "name": "eles", "descr": "A collection of elements to remove." } ] }, { "descr": "Remove elements in the graph matching the specified selector.", "args": [ { "name": "selector", "descr": "Elements matching this selector are removed." } ] } ], "md": "core/remove" }, { "name": "cy.collection", "descr": "Return a new collection, empty or with new elements in a removed state.", "formats": [ { "descr": "Get an empty collection." }, { "name": "cy.collection", "descr": "Create a collection with new elements in a removed state.", "args": [ { "name": "eleObjs", "descr": "Elements to be created" }, { "name": "options", "descr": "The options for the collection", "fields": [ { "name": "removed", "descr": "A truthy value that sets whether the elements are in the removed state (true) or added to the graph (false, default)." } ] } ] } ], "md": "core/collection" }, { "name": "cy.getElementById", "pureAliases": ["cy.$id"], "descr": "Get an element from its ID in a very performant way.", "formats": [ { "args": [ { "name": "id", "descr": "The ID of the element to get." } ] } ], "md": "core/getElementById" }, { "name": "cy.$", "descr": "Get elements in the graph matching a selector or a filter function.", "formats": [ { "name": "cy.$", "descr": "Get elements in the graph matching the specified selector.", "args": [ { "name": "selector", "descr": "The selector the elements should match." } ] }, { "name": "cy.elements", "descr": "Get elements in the graph matching the specified selector.", "args": [ { "name": "selector", "descr": "The selector the elements should match." } ] }, { "name": "cy.nodes", "descr": "Get nodes in the graph matching the specified selector.", "args": [ { "name": "selector", "descr": "The selector the nodes should match." } ] }, { "name": "cy.edges", "descr": "Get edges in the graph matching the specified selector.", "args": [ { "name": "selector", "descr": "The selector the edges should match." } ] }, { "name": "cy.filter", "descr": "Get elements in the graph matching the specified selector.", "args": [ { "name": "selector", "descr": "The selector the elements should match." } ] }, { "name": "cy.filter", "descr": "Get elements in the graph matching the specified filter function.", "args": [ { "name": "function(ele, i, eles)", "descr": "The filter function that returns true for elements that should be returned.", "fields": [ { "name": "ele", "descr": "The current element under consideration for filtering." }, { "name": "i", "descr": "The counter used for iteration over the elements in the graph." }, { "name": "eles", "descr": "The collection of elements being filtered" } ] } ] } ], "md": "core/elements" }, { "name": "cy.batch", "descr": "Allow for manipulation of elements without triggering multiple style calculations or multiple redraws.", "formats": [ { "args": [ { "name": "function()", "descr": "A callback within which you can make batch updates to elements." } ] }, { "name": "cy.startBatch", "descr": "Starts batching manually (useful for asynchronous cases)." }, { "name": "cy.endBatch", "descr": "Ends batching manually (useful for asynchronous cases)." } ], "md": "core/batch" }, { "name": "cy.mount", "descr": "Attaches the instance to the specified container for visualisation.", "formats": [ { "args": [ { "name": "container", "descr": "A HTML DOM element in which the graph should be rendered." } ] } ], "md": "core/mount" }, { "name": "cy.unmount", "descr": "Remove the instance from its current container.", "md": "core/unmount" }, { "name": "cy.destroy", "descr": "A convenience function to explicitly destroy the instance.", "md": "core/destroy" }, { "name": "cy.destroyed", "descr": "Get whether the instance of Cytoscape.js has been destroyed or not." } ] }, { "name": "Data", "fns": [ { "name": "cy.data", "pureAliases": [ "cy.attr" ], "descr": "Read and write developer-defined data associated with the graph.", "formatsSameFn": true, "formats": [ { "name": "cy.data", "descr": "Get the entire data object." }, { "name": "cy.data", "descr": "Get a particular data field.", "args": [ { "name": "name", "descr": "The name of the field to get." } ] }, { "name": "cy.data", "descr": "Set a particular data field.", "args": [ { "name": "name", "descr": "The name of the field to set." }, { "name": "value", "descr": "The value to set for the field." } ] }, { "name": "cy.data", "descr": "Update multiple data fields at once via an object.", "args": [ { "name": "obj", "descr": "The object containing name-value pairs to update data fields." } ] } ] }, { "name": "cy.removeData", "pureAliases": [ "cy.removeAttr" ], "descr": "Remove developer-defined data associated with the elements.", "formats": [ { "descr": "Removes all mutable data fields for the elements." }, { "descr": "Removes the specified mutable data fields for the elements.", "args": [ { "name": "names", "descr": "A space-separated list of fields to delete." } ] } ] }, { "name": "cy.scratch", "extFn": true, "descr": "Set or get scratchpad data, where temporary or non-JSON data can be stored. App-level scratchpad data should use namespaces prefixed with underscore, like `'_foo'`. This is analogous to the more common [`ele.scratch()`](#ele.scratch) but for graph global data.", "formats": [ { "descr": "Get the entire scratchpad object for the core." }, { "descr": "Get the scratchpad at a particular namespace.", "args": [ { "name": "namespace", "descr": "A namespace string." } ] }, { "descr": "Set the scratchpad at a particular namespace.", "args": [ { "name": "namespace", "descr": "A namespace string." }, { "name": "value", "descr": "The value to set at the specified namespace." } ] } ] }, { "name": "cy.removeScratch", "extFn": true, "descr": "Remove scratchpad data. You should remove scratchpad data only at your own namespaces. This is analogous to the more common [`ele.removeScratch()`](#ele.removeScratch) but for graph global data.", "formats": [ { "descr": "Remove the scratchpad data at a particular namespace.", "args": [ { "name": "namespace", "descr": "A namespace string." } ] } ], "md": "collection/removeScratch" } ] }, { "name": "Events", "fns": [ { "name": "cy.on", "pureAliases": ["cy.bind", "cy.listen", "cy.addListener"], "descr": "Listen to events that occur on the core.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "A selector to specify elements for which the handler runs.", "optional": true }, { "name": "function(event)", "descr": "The handler function that is called when one of the specified events occurs.", "fields": [ { "name": "event", "descr": "The event object." } ] } ] } ], "md": "core/on" }, { "name": "cy.promiseOn", "pureAliases": ["cy.pon"], "descr": "Get a promise that is resolved when the core emits the first of any of the specified events.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "A selector to specify elements for which the handler runs.", "optional": true } ] } ], "md": "core/promiseOn" }, { "name": "cy.one", "descr": "Listen to events that occur on the core, and run the handler only once.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "A selector to specify elements for which the handler runs.", "optional": true }, { "name": "function(event)", "descr": "The handler function that is called when one of the specified events occurs.", "fields": [ { "name": "event", "descr": "The event object." } ] } ] } ], "md": "core/one" }, { "name": "cy.removeListener", "pureAliases": ["cy.off", "cy.unbind", "cy.unlisten"], "descr": "Remove event handlers on the core.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "The same selector used to listen to the events.", "optional": true }, { "name": "handler", "descr": "A reference to the handler function to remove.", "optional": true } ] } ], "md": "core/removeListener" }, { "name": "cy.removeAllListeners", "descr": "Remove all event handlers on the core." }, { "name": "cy.emit", "pureAliases": ["cy.trigger"], "descr": "Emit one or more events.", "formats": [ { "args": [ { "name": "events", "descr": "A list of event names to emit (either a space-separated string or an array)" }, { "name": "extraParams", "descr": "An array of additional parameters to pass to the handler.", "optional": true } ] } ], "md": "core/emit" }, { "name": "cy.ready", "descr": "Run a callback as soon as the graph becomes ready (i.e. intitial data loaded and initial layout completed). If the graph is already ready, then the callback is called immediately. If data is loaded synchronously and the layout used is discrete/synchronous/unanimated/unspecified, then you don't need `cy.ready()`.", "formats": [ { "args": [ { "name": "function(event)", "descr": "The callback run as soon as the graph is ready.", "fields": [ { "name": "event", "descr": "The `ready` event." } ] } ] } ] } ] }, { "name": "Viewport manipulation", "fns": [ { "name": "cy.container", "descr": "Get the HTML DOM element in which the graph is visualised. A null value is returned if the instance is headless." }, { "name": "cy.center", "pureAliases": ["cy.centre"], "descr": "Pan the graph to the centre of a collection.", "formats": [ { "descr": "Centre on all elements in the graph." }, { "descr": "Centre on the specified elements.", "args": [ { "name": "eles", "descr": "The collection to centre upon." } ] } ], "md": "core/center" }, { "name": "cy.fit", "descr": "Pan and zooms the graph to fit to a collection.", "formats": [ { "descr": "Fit to all elements in the graph." }, { "descr": "Fit to the specified elements.", "args": [ { "name": "eles", "descr": "The collection to fit to.", "optional": true }, { "name": "padding", "descr": "An amount of padding (in rendered pixels) to have around the graph (default `0`).", "optional": true } ] } ], "md": "core/fit" }, { "name": "cy.reset", "descr": "Reset the graph to the default zoom level and panning position.", "formats": [ { "descr": "Resets the zoom and pan." } ], "md": "core/reset" }, { "name": "cy.pan", "descr": "Get or set the panning position of the graph.", "formats": [ { "descr": "Get the current panning position." }, { "descr": "Set the current panning position.", "args": [ { "name": "renderedPosition", "descr": "The rendered position to pan the graph to." } ] } ], "md": "core/pan" }, { "name": "cy.panBy", "descr": "Relatively pan the graph by a specified rendered position vector.", "formats": [ { "args": [ { "name": "renderedPosition", "descr": "The rendered position vector to pan the graph by." } ] } ], "md": "core/panBy" }, { "name": "cy.panningEnabled", "descr": "Get or set whether panning is enabled.", "formats": [ { "descr": "Get whether panning is enabled." }, { "descr": "Set whether panning is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables panning; a falsey value disables it." } ] } ], "md": "core/panningEnabled" }, { "name": "cy.userPanningEnabled", "descr": "Get or set whether panning by user events (e.g. dragging the graph background) is enabled.", "formats": [ { "descr": "Get whether user panning is enabled." }, { "descr": "Set whether user panning is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables user panning; a falsey value disables it." } ] } ], "md": "core/userPanningEnabled" }, { "name": "cy.zoom", "descr": "Get or set the zoom level of the graph.", "formats": [ { "descr": "Get the zoom level." }, { "descr": "Set the zoom level.", "args": [ { "name": "level", "descr": "The zoom level to set." } ] }, { "descr": "Set the zoom level.", "args": [ { "name": "options", "descr": "The options for zooming.", "fields": [ { "name": "level", "descr": "The zoom level to set." }, { "name": "position", "descr": "The position about which to zoom." }, { "name": "renderedPosition", "descr": "The rendered position about which to zoom." } ] } ] } ], "md": "core/zoom" }, { "name": "cy.zoomingEnabled", "descr": "Get or set whether zooming is enabled.", "formats": [ { "descr": "Get whether zooming is enabled." }, { "descr": "Set whether zooming is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables zooming; a falsey value disables it." } ] } ], "md": "core/zoomingEnabled" }, { "name": "cy.userZoomingEnabled", "descr": "Get or set whether zooming by user events (e.g. mouse wheel, pinch-to-zoom) is enabled.", "formats": [ { "descr": "Get whether user zooming is enabled." }, { "descr": "Set whether user zooming is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables user zooming; a falsey value disables it." } ] } ], "md": "core/userZoomingEnabled" }, { "name": "cy.minZoom", "descr": "Get or set the minimum zoom level.", "formats": [ { "descr": "Get the minimum zoom level." }, { "descr": "Set the minimum zoom level.", "args": [ { "name": "zoom", "descr": "The new minimum zoom level to use." } ] } ] }, { "name": "cy.maxZoom", "descr": "Get or set the maximum zoom level.", "formats": [ { "descr": "Get the maximum zoom level." }, { "descr": "Set the maximum zoom level.", "args": [ { "name": "zoom", "descr": "The new maximum zoom level to use." } ] } ] }, { "name": "cy.viewport", "descr": "Set the viewport state (pan & zoom) in one call.", "formats": [ { "args": [ { "name": "options", "descr": "The viewport options.", "fields": [ { "name": "zoom", "descr": "The zoom level to set." }, { "name": "pan", "descr": "The pan to set (a rendered position)." } ] } ] } ], "md": "core/viewport" }, { "name": "cy.boxSelectionEnabled", "descr": "Get or set whether box selection is enabled. If enabled along with panning, the user must hold down one of shift, control, alt, or command to initiate box selection.", "formats": [ { "descr": "Get whether box selection is enabled." }, { "descr": "Set whether box selection is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables box selection; a falsey value disables it." } ] } ], "md": "core/boxSelectionEnabled" }, { "name": "cy.selectionType", "descr": "Get or set the selection type. The `'single'` selection type is the default, tapping an element selects that element and deselects the previous elements. The `'additive' selection type toggles the selection state of an element when tapped.`", "formats": [ { "descr": "Get the selection type string." }, { "descr": "Set the selection type.", "args": [ { "name": "type", "descr": "The selection type string; one of `'single'` (default) or `'additive'`." } ] } ] }, { "name": "cy.width", "descr": "Get the on-screen width of the viewport in pixels." }, { "name": "cy.height", "descr": "Get the on-screen height of the viewport in pixels." }, { "name": "cy.extent", "descr": "Get the extent of the viewport, a bounding box in model co-ordinates that lets you know what model positions are visible in the viewport.", "md": "core/extent" }, { "name": "cy.renderedExtent", "descr": "Get the width and height of the viewport canvas in [rendered (on-screen) points](#notation/position).", "md": "core/extent" }, { "name": "cy.autolock", "descr": "Get or set whether nodes are automatically locked (i.e. if `true`, nodes are locked despite their individual state).", "formats": [ { "descr": "Get whether autolocking is enabled." }, { "descr": "Set whether autolocking is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables autolocking; a falsey value disables it." } ] } ], "md": "core/autolock" }, { "name": "cy.autoungrabify", "descr": "Get or set whether nodes are automatically ungrabified (i.e. if `true`, nodes are ungrabbable despite their individual state).", "formats": [ { "descr": "Get whether autoungrabifying is enabled." }, { "descr": "Set whether autoungrabifying is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables autoungrabbifying; a falsey value disables it." } ] } ], "md": "core/autoungrabify" }, { "name": "cy.autounselectify", "descr": "Get or set whether nodes are automatically unselectified (i.e. if `true`, nodes are unselectable despite their individual state).", "formats": [ { "descr": "Get whether autounselectifying is enabled." }, { "descr": "Set whether autounselectifying is enabled.", "args": [ { "name": "bool", "descr": "A truthy value enables autounselectifying; a falsey value disables it." } ] } ], "md": "core/autounselectify" }, { "name": "cy.resize", "pureAliases": ["cy.invalidateDimensions"], "descr": "Force the renderer to recalculate the viewport bounds.", "md": "core/resize" } ] }, { "name": "Animation", "fns": [ { "name": "cy.animated", "descr": "Get whether the viewport is currently being animated." }, { "name": "cy.animate", "descr": "Animate the viewport.", "formats": [ { "args": [ { "name": "options", "descr": "An object containing the details of the animation.", "fields": [ { "name": "zoom", "descr": "A zoom level (number) or a zoom configuration object to which the graph will be animated.", "fields": [ { "name": "level", "descr": "The zoom level to use." }, { "name": "position", "descr": "The position about which zooming occurs. This automatically modifies the pan such that the specified model position remains at the same position in the viewport extent during zooming." }, { "name": "renderedPosition", "descr": "The rendered position about which zooming occurs, as an alternative to using the model position. This automatically modifies the pan such that the model position, corresponding to the rendered position at the start of the animation, remains at the same position in the viewport extent during zooming." } ] }, { "name": "pan", "descr": "A panning position to which the graph will be animated." }, { "name": "panBy", "descr": "A relative panning position to which the graph will be animated." }, { "name": "fit", "descr": "An object containing fitting options from which the graph will be animated.", "fields": [ { "name": "eles", "descr": "Elements or a selector to which the viewport will be fitted." }, { "name": "padding", "descr": "Padding to use with the fitting (default `0`)." } ] }, { "name": "center", "descr": "An object containing centring options from which the graph will be animated.", "fields": [ { "name": "eles", "descr": "Elements or a selector to which the viewport will be centred." } ] }, { "name": "duration", "descr": "The duration of the animation in milliseconds." }, { "name": "queue", "descr": "A boolean indicating whether to queue the animation (default `true`). Queued animations on the core run in order until the queue is empty." }, { "name": "easing", "descr": "A [`transition-timing-function`](#style/transition-animation) easing style string that shapes the animation progress curve." }, { "name": "complete", "descr": "A function to call when the animation is done." }, { "name": "step", "descr": "A function to call each time the animation steps." } ] } ] } ], "md": "core/animate" }, { "name": "cy.animation", "descr": "Get an [animation](#animations) of the viewport.", "formats": [ { "args": [ { "name": "options", "descr": "An object containing the details of the animation.", "fields": [ { "name": "zoom", "descr": "A zoom level (number) or a zoom configuration object to which the graph will be animated.", "fields": [ { "name": "level", "descr": "The zoom level to use." }, { "name": "position", "descr": "The position about which zooming occurs. This automatically modifies the pan such that the specified model position remains at the same position in the viewport extent during zooming." }, { "name": "renderedPosition", "descr": "The rendered position about which zooming occurs, as an alternative to using the model position. This automatically modifies the pan such that the model position, corresponding to the rendered position at the start of the animation, remains at the same position in the viewport extent during zooming." } ] }, { "name": "pan", "descr": "A panning position to which the graph will be animated." }, { "name": "panBy", "descr": "A relative panning position to which the graph will be animated." }, { "name": "fit", "descr": "An object containing fitting options from which the graph will be animated.", "fields": [ { "name": "eles", "descr": "Elements or a selector to which the viewport will be fitted." }, { "name": "padding", "descr": "Padding to use with the fitting (default `0`)." } ] }, { "name": "center", "descr": "An object containing centring options from which the graph will be animated.", "fields": [ { "name": "eles", "descr": "Elements or a selector to which the viewport will be centred." } ] }, { "name": "duration", "descr": "The duration of the animation in milliseconds." }, { "name": "easing", "descr": "A [`transition-timing-function`](#style/transition-animation) easing style string that shapes the animation progress curve." }, { "name": "complete", "descr": "A function to call when the animation is done." }, { "name": "step", "descr": "A function to call each time the animation steps." } ] } ] } ] }, { "name": "cy.delay", "descr": "Add a delay between queued animations for the viewport.", "formats": [ { "args": [ { "name": "duration", "descr": "How long the delay should be in milliseconds." }, { "name": "complete", "descr": "A function to call when the delay is complete." } ] } ], "md": "core/delay" }, { "name": "cy.delayAnimation", "descr": "Get a delay [animation](#animations) of the viewport.", "formats": [ { "args": [ { "name": "duration", "descr": "How long the delay should be in milliseconds." } ] } ] }, { "name": "cy.stop", "descr": "Stop all viewport animations that are currently running.", "formats": [ { "args": [ { "name": "clearQueue", "descr": "A boolean (default `false`), indicating whether the queue of animations should be emptied." }, { "name": "jumpToEnd", "descr": "A boolean (default `false`), indicating whether the currently-running animations should jump to their ends rather than just stopping midway." } ] } ], "md": "core/stop" }, { "name": "cy.clearQueue", "descr": "Remove all queued animations for the viewport." } ] }, { "name": "Layout", "fns": [ { "name": "cy.layout", "pureAliases": ["cy.createLayout", "cy.makeLayout"], "descr": "Get a new layout, which can be used to algorithmically position the nodes in the graph.", "formats": [ { "args": [ { "name": "options", "descr": "The layout options." } ] } ], "md": "core/layout" } ] }, { "name": "Style", "fns": [ { "name": "cy.style", "descr": "Get the entry point to modify the visual style of the graph after initialisation.", "formats": [ { "descr": "Get the current style object." }, { "descr": "Assign a new stylesheet to replace the existing one.", "args": [ { "name": "stylesheet", "descr": "Either a `cytoscape.stylesheet()` object, a string stylesheet, or a JSON stylesheet (the same formats accepted for [`options.style`](#style) at initialisation)." } ] } ], "md": "core/style" } ] }, { "name": "Export", "fns": [ { "name": "cy.png", "descr": "Export the current graph view as a PNG image.", "formats": [ { "args": [ { "name": "options", "descr": "The export options.", "fields": [ { "name": "output", "descr": "Whether the output should be `'base64uri'` (default), `'base64'`, `'blob'`, or `'blob-promise'` (a promise that resolves to the blob is returned)." }, { "name": "bg", "descr": "The background colour of the image (transparent by default)." }, { "name": "full", "descr": "Whether to export the current viewport view (`false`, default) or the entire graph (`true`)." }, { "name": "scale", "descr": "This value specifies a positive number that scales the size of the resultant image." }, { "name": "maxWidth", "descr": "Specifies the scale automatically in combination with `maxHeight` such that the resultant image is no wider than `maxWidth`." }, { "name": "maxHeight", "descr": "Specifies the scale automatically in combination with `maxWidth` such that the resultant image is no taller than `maxHeight`." } ] } ] } ], "md": "core/png" }, { "name": "cy.jpg", "pureAliases": ["cy.jpeg"], "descr": "Export the current graph view as a JPG image.", "formats": [ { "args": [ { "name": "options", "descr": "The export options.", "fields": [ { "name": "output", "descr": "Whether the output should be `'base64uri'` (default), `'base64'`, `'blob'`, or `'blob-promise'` (a promise that resolves to the blob is returned)." }, { "name": "bg", "descr": "The background colour of the image (white by default)." }, { "name": "full", "descr": "Whether to export the current viewport view (`false`, default) or the entire graph (`true`)." }, { "name": "scale", "descr": "This value specifies a positive number that scales the size of the resultant image." }, { "name": "maxWidth", "descr": "Specifies the scale automatically in combination with `maxHeight` such that the resultant image is no wider than `maxWidth`." }, { "name": "maxHeight", "descr": "Specifies the scale automatically in combination with `maxWidth` such that the resultant image is no taller than `maxHeight`." }, { "name": "quality", "descr": "Specifies the quality of the image from `0` (low quality, low filesize) to `1` (high quality, high filesize). If not set, the browser's default quality value is used." } ] } ] } ], "md": "core/jpg" }, { "name": "cy.json", "descr": "Import or export the graph in the same JSON format used at initialisation.", "formats": [ { "descr": "Export the graph as JSON.", "args": [ { "name": "flatEles", "descr": "Whether the resulant JSON should include the elements as a flat array (`true`) or as two keyed arrays by group (`false`, default)." } ] }, { "descr": "Import the graph as JSON, updating only the fields specified.", "args": [ { "name": "cyJson", "descr": "The object with the fields corresponding to the states that should be changed." } ] } ], "md": "core/json" } ] } ] }, { "name": "Collection", "md": "collection/collection", "sections": [ { "name": "Graph manipulation", "fns": [ { "name": "ele.cy", "descr": "Get the core instance that owns the element." }, { "name": "eles.remove", "descr": "Remove the elements from the graph, and return all elements removed by this call.", "md": "collection/remove" }, { "name": "ele.removed", "descr": "Get whether the element has been removed from the graph." }, { "name": "ele.inside", "descr": "Get whether the element is inside the graph (i.e. not removed)." }, { "name": "eles.restore", "descr": "Put removed elements back into the graph.", "md": "collection/restore" }, { "name": "eles.clone", "pureAliases": [ "eles.copy" ], "descr": "Get a new collection containing clones (i.e. copies) of the elements in the calling collection." }, { "name": "eles.move", "descr": "Move the elements with respect to graph topology (i.e. new `source`, `target`, or `parent`).", "formats": [ { "name": "edges.move", "descr": "Change the source, target, or both source and target.", "args": [ { "name": "location", "descr": "Where the edges are moved. You can specify a new source, a new target, or both.", "fields": [ { "name": "source", "descr": "The ID of the new source node." }, { "name": "target", "descr": "The ID of the new target node." } ] } ] }, { "name": "nodes.move", "descr": "Change the parent.", "args": [ { "name": "location", "descr": "Where the nodes are moved.", "fields": [ { "name": "parent", "descr": "The ID of the new parent node (use `null` for no parent)." } ] } ] } ], "md": "collection/move" } ] }, { "name": "Events", "fns": [ { "name": "eles.on", "pureAliases": ["eles.bind", "eles.listen", "eles.addListener"], "descr": "Listen to events that occur on the elements.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "A delegate selector to specify child elements for which the handler runs.", "optional": true }, { "name": "function(event)", "descr": "The handler function that is called when one of the specified events occurs.", "fields": [ { "name": "event", "descr": "The event object." } ] } ] } ], "md": "collection/on" }, { "name": "eles.promiseOn", "pureAliases": ["eles.pon"], "descr": "Get a promise that is resolved the first time any of the elements emit any of the specified events.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "A selector to specify elements for which the handler is emitted.", "optional": true } ] } ], "md": "collection/promiseOn" }, { "name": "eles.one", "descr": "Add a listener that is called once per event per element.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "A delegate selector to specify child elements for which the handler runs.", "optional": true }, { "name": "function(event)", "descr": "The handler function that is called when one of the specified events occurs.", "fields": [ { "name": "event", "descr": "The event object." } ] } ] } ], "md": "collection/one" }, { "name": "eles.once", "descr": "Add a listener that is called once per event per collection.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "A delegate selector to specify child elements for which the handler runs.", "optional": true }, { "name": "function(event)", "descr": "The handler function that is called when one of the specified events occurs.", "fields": [ { "name": "event", "descr": "The event object." } ] } ] } ], "md": "collection/once" }, { "name": "eles.removeListener", "pureAliases": ["eles.off", "eles.unbind", "eles.unlisten"], "descr": "Remove one or more listeners on the elements.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "selector", "descr": "The same delegate selector used to listen to the events.", "optional": true }, { "name": "handler", "descr": "A reference to the handler function to remove.", "optional": true } ] } ], "md": "collection/removeListener" }, { "name": "eles.removeAllListeners", "descr": "Remove all event handlers on the elements." }, { "name": "eles.emit", "pureAliases": ["eles.trigger"], "descr": "Emit events on the elements.", "formats": [ { "args": [ { "name": "events", "descr": "A list of event names to emit (either a space-separated string or an array)" }, { "name": "extraParams", "descr": "An array of additional parameters to pass to the handler.", "optional": true } ] } ], "md": "collection/emit" } ] }, { "name": "Data", "fns": [ { "name": "eles.data", "pureAliases": [ "eles.attr" ], "descr": "Read and write developer-defined data associated with the elements.", "formatsSameFn": true, "formats": [ { "name": "ele.data", "descr": "Get the entire data object." }, { "name": "ele.data", "descr": "Get a particular data field for the element.", "args": [ { "name": "name", "descr": "The name of the field to get." } ] }, { "name": "ele.data", "descr": "Set a particular data field for the element.", "args": [ { "name": "name", "descr": "The name of the field to set." }, { "name": "value", "descr": "The value to set for the field." } ] }, { "name": "ele.data", "descr": "Update multiple data fields at once via an object.", "args": [ { "name": "obj", "descr": "The object containing name-value pairs to update data fields." } ] } ], "md": "collection/data" }, { "name": "eles.removeData", "pureAliases": [ "eles.removeAttr" ], "descr": "Remove developer-defined data associated with the elements.", "formats": [ { "descr": "Removes all mutable data fields for the elements." }, { "descr": "Removes the specified mutable data fields for the elements.", "args": [ { "name": "names", "descr": "A space-separated list of fields to delete." } ] } ], "md": "collection/removeData" }, { "name": "ele.scratch", "extFn": true, "descr": "Set or get scratchpad data, where temporary or non-JSON data can be stored. App-level scratchpad data should use namespaces prefixed with underscore, like `'_foo'`.", "formats": [ { "descr": "Get the entire scratchpad object for the element." }, { "descr": "Get the scratchpad at a particular namespace.", "args": [ { "name": "namespace", "descr": "A namespace string." } ] }, { "descr": "Set the scratchpad at a particular namespace.", "args": [ { "name": "namespace", "descr": "A namespace string." }, { "name": "value", "descr": "The value to set at the specified namespace." } ] } ], "md": "collection/scratch" }, { "name": "ele.removeScratch", "extFn": true, "descr": "Remove scratchpad data. You should remove scratchpad data only at your own namespaces.", "formats": [ { "descr": "Remove the scratchpad data at a particular namespace.", "args": [ { "name": "namespace", "descr": "A namespace string." } ] } ] }, { "name": "ele.id", "descr": "A shortcut to get the ID of an element." }, { "name": "ele.json", "descr": "Get or mutate the element's plain JavaScript object representation.", "formats": [ { "descr": "Get the element's JSON.", "args": [] }, { "descr": "Mutate the element's state as specified.", "args": [ { "name": "eleJson", "descr": "For each field in the object, the element's state is mutated as specified." } ] } ], "md": "collection/json" }, { "name": "eles.jsons", "descr": "Get an array of the plain JavaScript object representation of all elements in the collection.", "md": "collection/jsons" }, { "name": "ele.group", "descr": "Get the group string that defines the type of the element.", "md": "collection/group" }, { "name": "ele.isNode", "descr": "Get whether the element is a node." }, { "name": "ele.isEdge", "descr": "Get whether the element is an edge." }, { "name": "edge.isLoop", "descr": "Get whether the edge is a loop (i.e. same source and target)." }, { "name": "edge.isSimple", "descr": "Get whether the edge is simple (i.e. different source and target)." } ] }, { "name": "Metadata", "fns": [ { "name": "node.degree", "formats": [ { "name": "node.degree", "descr": "Get the degree of a node.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "node.indegree", "descr": "Get the indegree of a node.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "node.outdegree", "descr": "Get the outdegree of a node.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "nodes.totalDegree", "descr": "Get the total degree of a collection of nodes.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "nodes.minDegree", "descr": "Get the minimum degree of the nodes in the collection.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "nodes.maxDegree", "descr": "Get the maximum degree of the nodes in the collection.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "nodes.minIndegree", "descr": "Get the minimum indegree of the nodes in the collection.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "nodes.maxIndegree", "descr": "Get the maximum indegree of the nodes in the collection.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "nodes.minOutdegree", "descr": "Get the minimum outdegree of the nodes in the collection.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] }, { "name": "nodes.maxOutdegree", "descr": "Get the maximum outdegree of the nodes in the collection.", "args": [ { "name": "includeLoops", "descr": "A boolean, indicating whether loops are to be included in degree calculations." } ] } ], "md": "collection/degree" } ] }, { "name": "Position & dimensions", "fns": [ { "name": "node.position", "pureAliases": [ "node.modelPosition", "node.point" ], "descr": "Get or set the [model position](#notation/position) of a node.", "formats": [ { "descr": "Get the entire position object." }, { "descr": "Get the value of a specified position dimension.", "args": [ { "name": "dimension", "descr": "The position dimension to get." } ] }, { "descr": "Set the value of a specified position dimension.", "args": [ { "name": "dimension", "descr": "The position dimension to set." }, { "name": "value", "descr": "The value to set to the dimension." } ] }, { "descr": "Set the position using name-value pairs in the specified object.", "args": [ { "name": "pos", "descr": "An object specifying name-value pairs representing dimensions to set." } ] } ], "md": "collection/position" }, { "name": "nodes.shift", "descr": "Shift the positions of the nodes by a given [model position](#notation/position) vector.", "formats": [ { "descr": "Shift the nodes by one of `'x'` or `'y'`.", "args": [ { "name": "dimension", "descr": "The position dimension to shift." }, { "name": "value", "descr": "The value to shift the dimension." } ] }, { "descr": "Shift the nodes by a position vector.", "args": [ { "name": "pos", "descr": "An object specifying name-value pairs representing dimensions to shift." } ] } ], "md": "collection/shift" }, { "name": "nodes.positions", "pureAliases": [ "nodes.modelPositions", "nodes.points" ], "descr": "Set the [model positions](#notation/position) of several nodes with a function.", "formats": [ { "descr": "Set the positions via a function.", "args": [ { "name": "function(ele, i)", "descr": "A callback function that returns the position to set for each element.", "fields": [ { "name": "ele", "descr": "The element being iterated over for which the function should return a position to set." }, { "name": "i", "descr": "The index of the element when iterating over the elements in the collection." } ] } ] }, { "descr": "Set positions for all nodes based on a single position object.", "args": [ { "name": "pos", "descr": "An object specifying name-value pairs representing dimensions to set." } ] } ], "md": "collection/positions" }, { "name": "node.renderedPosition", "pureAliases": [ "node.renderedPoint" ], "descr": "Get or set the [rendered (on-screen) position](#notation/position) of a node.", "formats": [ { "descr": "Get the entire rendered position object." }, { "descr": "Get the value of a specified rendered position dimension.", "args": [ { "name": "dimension", "descr": "The position dimension to get." } ] }, { "descr": "Set the value of a specified rendered position dimension.", "args": [ { "name": "dimension", "descr": "The position dimension to set." }, { "name": "value", "descr": "The value to set to the dimension." } ] }, { "descr": "Set the rendered position using name-value pairs in the specified object.", "args": [ { "name": "pos", "descr": "An object specifying name-value pairs representing dimensions to set." } ] } ] }, { "name": "node.relativePosition", "pureAliases": [ "node.relativePoint" ], "descr": "Get or set the [model position](#notation/position) of a node, relative to its compound parent.", "formats": [ { "descr": "Get the entire relative position object." }, { "descr": "Get the value of a specified relative position dimension.", "args": [ { "name": "dimension", "descr": "The position dimension to get." } ] }, { "descr": "Set the value of a specified relative position dimension.", "args": [ { "name": "dimension", "descr": "The position dimension to set." }, { "name": "value", "descr": "The value to set to the dimension." } ] }, { "descr": "Set the relative position using name-value pairs in the specified object.", "args": [ { "name": "pos", "descr": "An object specifying name-value pairs representing dimensions to set." } ] } ] }, { "name": "ele.width", "descr": "Get the width of the element. The raw width of the element is returned, independent of whether the element is visibile.", "formats": [ { "name": "ele.width", "descr": "Get the width of the element in [model dimensions](#notation/position)." }, { "name": "ele.outerWidth", "descr": "Get the outer width of the element in [model dimensions](#notation/position) (includes width, padding, & border)." }, { "name": "ele.renderedWidth", "descr": "Get the width of the element in [rendered dimensions](#notation/position)." }, { "name": "ele.renderedOuterWidth", "descr": "Get the outer width of the element in [rendered dimensions](#notation/position) (includes width, padding, & border) in rendered dimensions." } ] }, { "name": "ele.height", "descr": "Get the height of the element. The raw height of the element is returned, independent of whether the element is visibile.", "formats": [ { "name": "ele.height", "descr": "Get the height of the element in [model dimensions](#notation/position)." }, { "name": "ele.outerHeight", "descr": "Get the outer height of the element in [model dimensions](#notation/position) (includes height, padding, & border)." }, { "name": "ele.renderedHeight", "descr": "Get the height of the element in [rendered dimensions](#notation/position)." }, { "name": "ele.renderedOuterHeight", "descr": "Get the outer height of the element in [rendered dimensions](#notation/position) (includes height, padding, & border) in rendered dimensions." } ] }, { "name": "eles.boundingBox", "pureAliases": [ "eles.boundingbox", "eles.bb" ], "descr": "Get the bounding box of the elements (in [model co-ordinates](#notation/position)).", "formats": [ { "name": "eles.boundingBox", "descr": "Get the bounding box of the elements in [model co-ordinates](#notation/position).", "args": [ { "name": "options", "descr": "An object containing options for the function.", "fields": [ { "name": "includeNodes", "descr": "A boolean indicating whether to include nodes in the bounding box (default `true`)." }, { "name": "includeEdges", "descr": "A boolean indicating whether to include edges in the bounding box (default `true`)." }, { "name": "includeLabels", "descr": "A boolean indicating whether to include labels overall in the bounding box (default `true`). This option overrides all other label options if `false`." }, { "name": "includeMainLabels", "descr": "A boolean indicating whether to include main (node or edge) `label`s in the bounding box (default `true`)." }, { "name": "includeSourceLabels", "descr": "A boolean indicating whether to include (edge) `source-label`s in the bounding box (default `true`)." }, { "name": "includeTargetLabels", "descr": "A boolean indicating whether to include (edge) `target-label`s in the bounding box (default `true`)." }, { "name": "includeOverlays", "descr": "A boolean indicating whether to include overlays (such as the one which appears when a node is clicked) in the bounding box (default `true`)." }, { "name": "includeUnderlays", "descr": "A boolean indicating whether to include underlays (configurable in node or edge style) in the bounding box (default `true`)." } ] } ] } ], "md": "collection/boundingBox" }, { "name": "eles.renderedBoundingBox", "pureAliases": [ "eles.renderedBoundingbox" ], "descr": "Get the [rendered](#notation/position) bounding box of the elements.", "formats": [ { "name": "eles.renderedBoundingBox", "descr": "Get the bounding box of the elements in rendered co-ordinates.", "args": [ { "name": "options", "descr": "An object containing options for the function.", "fields": [ { "name": "includeNodes", "descr": "A boolean indicating whether to include nodes in the bounding box (default `true`)." }, { "name": "includeEdges", "descr": "A boolean indicating whether to include edges in the bounding box (default `true`)." }, { "name": "includeLabels", "descr": "A boolean indicating whether to include labels overall in the bounding box (default `true`). This option overrides all other label options if `false`." }, { "name": "includeMainLabels", "descr": "A boolean indicating whether to include main (node or edge) `label`s in the bounding box (default `true`)." }, { "name": "includeSourceLabels", "descr": "A boolean indicating whether to include (edge) `source-label`s in the bounding box (default `true`)." }, { "name": "includeTargetLabels", "descr": "A boolean indicating whether to include (edge) `target-label`s in the bounding box (default `true`)." }, { "name": "includeOverlays", "descr": "A boolean indicating whether to include overlays (such as the one which appears when a node is clicked) in the bounding box (default `true`)." }, { "name": "includeUnderlays", "descr": "A boolean indicating whether to include underlays (configurable in node or edge style) in the bounding box (default `true`)." } ] } ] } ], "md": "collection/boundingBox" }, { "name": "node.grabbed", "descr": "Get whether a node is currently grabbed, meaning the user has hold of the node." }, { "name": "node.grabbable", "descr": "Get whether the user can grab a node." }, { "name": "nodes.grabify", "descr": "Allow the user to grab the nodes.", "md": "collection/grabify" }, { "name": "nodes.ungrabify", "descr": "Disallow the user to grab the nodes.", "md": "collection/ungrabify" }, { "name": "node.locked", "descr": "Get whether a node is locked, meaning that its position can not be changed." }, { "name": "nodes.lock", "descr": "Lock the nodes such that their positions can not be changed.", "md": "collection/lock" }, { "name": "nodes.unlock", "descr": "Unlock the nodes such that their positions can be changed.", "md": "collection/unlock" }, { "name": "ele.active", "descr": "Gets whether the element is active (e.g. on user tap, grab, etc)." }, { "name": "ele.pannable", "descr": "Gets whether the element allows passthrough panning.", "md": "collection/pannable" }, { "name": "eles.panify", "descr": "Enables passthrough panning on the elements.", "md": "collection/panify" }, { "name": "eles.unpanify", "descr": "Disables passthrough panning on the elements.", "md": "collection/unpanify" } ] }, { "name": "Edge points", "fns": [ { "name": "edge.controlPoints", "descr": "Get an array of control point positions for a [`curve-style: bezier`](#style/bezier-edges) or [`curve-style: unbundled-bezier`](#style/unbundled-bezier-edges) edge.", "formats": [ { "name": "edge.controlPoints", "descr": "Get the control points in [model co-ordinates](#notation/position)." }, { "name": "edge.renderedControlPoints", "descr": "Get the control points in [rendered co-ordinates](#notation/position)." } ], "md": "collection/controlPoints" }, { "name": "edge.segmentPoints", "descr": "Get an array of segment point positions (i.e. bend points) for a [`curve-style: segments`](#style/segments-edges) edge.", "formats": [ { "name": "edge.segmentPoints", "descr": "Get the segment points in [model co-ordinates](#notation/position)." }, { "name": "edge.renderedSegmentPoints", "descr": "Get the segment points in [rendered co-ordinates](#notation/position)." } ], "md": "collection/segmentPoints" }, { "name": "edge.sourceEndpoint", "descr": "Get the position of where the edge ends, towards the source node.", "formats": [ { "name": "edge.sourceEndpoint", "descr": "Get the source endpoint in [model co-ordinates](#notation/position)." }, { "name": "edge.renderedSourceEndpoint", "descr": "Get the target endpoint in [rendered co-ordinates](#notation/position)." } ] }, { "name": "edge.targetEndpoint", "descr": "Get the position of where the edge ends, towards the target node.", "formats": [ { "name": "edge.targetEndpoint", "descr": "Get the target endpoint in [model co-ordinates](#notation/position)." }, { "name": "edge.renderedTargetEndpoint", "descr": "Get the target endpoint in [rendered co-ordinates](#notation/position)." } ] }, { "name": "edge.midpoint", "descr": "Get the position of the midpoint of the edge.", "formats": [ { "name": "edge.midpoint", "descr": "Get the midpoint in [model co-ordinates](#notation/position)." }, { "name": "edge.renderedMidpoint", "descr": "Get the midpoint in [rendered co-ordinates](#notation/position)." } ], "md": "collection/midpoint.md" } ] }, { "name": "Layout", "fns": [ { "name": "eles.layout", "pureAliases": ["eles.createLayout", "eles.makeLayout"], "descr": "Get a new layout, which can be used to algorithmically position the nodes in the collection.", "formats": [ { "args": [ { "name": "options", "descr": "The layout options." } ] } ], "md": "collection/layout" }, { "name": "nodes.layoutPositions", "descr": "Position the nodes for a discrete/synchronous layout.", "extFn": true, "formats": [ { "args": [ { "name": "layout", "descr": "The layout." }, { "name": "options", "descr": "The layout options object." }, { "name": "function(ele, i)", "descr": "A function that returns the new position for the specified node.", "fields": [ { "name": "ele", "descr": "The node being iterated over for which the function should return a position to set." }, { "name": "i", "descr": "The index of the current node while iterating over the nodes in the layout." } ] } ] } ], "md": "collection/layoutPositions" }, { "name": "node.layoutDimensions", "descr": "Get the node width and height. This function is intended for use in layout positioning to do overlap detection.", "extFn": true, "formats": [ { "args": [ { "name": "options", "descr": "The layout options object." } ] } ], "md": "collection/layoutDimensions" } ] }, { "name": "Selection", "fns": [ { "name": "ele.selected", "descr": "Get whether the element is selected." }, { "name": "eles.select", "descr": "Make the elements selected. Elements outside the collection are not affected.", "md": "collection/select" }, { "name": "eles.unselect", "pureAliases": ["eles.deselect"], "descr": "Make the elements not selected. Elements outside the collection are not affected.", "md": "collection/unselect" }, { "name": "ele.selectable", "descr": "Get whether the element's selection state is mutable." }, { "name": "eles.selectify", "descr": "Make the selection states of the elements mutable.", "md": "collection/selectify" }, { "name": "eles.unselectify", "descr": "Make the selection states of the elements immutable.", "md": "collection/unselectify" } ] }, { "name": "Style", "fns": [ { "name": "eles.addClass", "descr": "Add classes to elements. The classes should be specified in the [stylesheet](#style) in order to have an effect on the rendered style of the elements.", "formats": [ { "args": [ { "name": "classes", "descr": "An array (or a space-separated string) of class names to add to the elements." } ] } ], "md": "collection/addClass" }, { "name": "eles.removeClass", "descr": "Remove classes from elements. The classes should be specified in the [stylesheet](#style) in order to have an effect on the rendered style of the elements.", "formats": [ { "args": [ { "name": "classes", "descr": "An array (or a space-separated string) of class names to remove from the elements." } ] } ], "md": "collection/removeClass" }, { "name": "eles.toggleClass", "descr": "Toggle whether the elements have the specified classes. The classes should be specified in the [stylesheet](#style) in order to have an effect on the rendered style of the elements.", "formats": [ { "args": [ { "name": "classes", "descr": "An array (or a space-separated string) of class names to toggle on the elements." }, { "name": "toggle", "descr": "Instead of automatically toggling, adds the classes on truthy values or removes them on falsey values.", "optional": true } ] } ], "md": "collection/toggleClass" }, { "name": "eles.classes", "pureAliases": ["eles.className", "eles.classNames"], "descr": "Get or replace the current list of classes on the elements with the specified list.", "formats": [ { "name": "ele.classes", "descr": "Get the list of classes as an array for the element." }, { "name": "eles.classes", "descr": "Replace the list of classes for all elements in the collection.", "args": [ { "name": "classes", "descr": "An array (or a space-separated string) of class names that replaces the current class list." } ] } ], "md": "collection/classes" }, { "name": "eles.flashClass", "descr": "Add classes to the elements, and then remove the classes after a specified duration.", "formats": [ { "args": [ { "name": "classes", "descr": "An array (or a space-separated string) of class names to flash on the elements." }, { "name": "duration", "descr": "The duration in milliseconds that the classes should be added on the elements. After the duration, the classes are removed.", "optional": true } ] } ], "md": "collection/flashClass" }, { "name": "ele.hasClass", "descr": "Get whether an element has a particular class.", "formats": [ { "args": [ { "name": "className", "descr": "The name of the class to test for." } ] } ], "md": "collection/hasClass" }, { "name": "eles.style", "pureAliases": [ "eles.css" ], "descr": "Get or override the style of the element.", "formatsSameFn": true, "formats": [ { "name": "ele.style", "descr": "Get a name-value pair object containing visual style properties and their values for the element." }, { "name": "ele.style", "descr": "Get a particular style property value.", "args": [ { "name": "name", "descr": "The name of the visual style property to get." } ] }, { "name": "eles.style", "descr": "Set a particular style property value.", "args": [ { "name": "name", "descr": "The name of the visual style property to set." }, { "name": "value", "descr": "The value of the visual style property to set." } ] }, { "name": "eles.style", "descr": "Set several particular style property values.", "args": [ { "name": "obj", "descr": "An object of style property name-value pairs to set." } ] }, { "name": "eles.removeStyle", "descr": "Remove all style overrides." }, { "name": "eles.removeStyle", "descr": "Remove specific style overrides.", "args": [ { "name": "names", "descr": "A space-separated list of property names to remove overrides." } ] } ], "md": "collection/style" }, { "name": "ele.numericStyle", "descr": "Get the numeric value of a style property in preferred units that can be used for calculations.", "formats": [ { "args": [ { "name": "name", "descr": "The name of the style property to get." } ] } ], "md": "collection/numericStyle" }, { "name": "ele.numericStyleUnits", "descr": "Get the units that `ele.numericStyle()` is expressed in, for a particular property.", "formats": [ { "args": [ { "name": "name", "descr": "The name of the style property to get." } ] } ] }, { "name": "ele.visible", "descr": "Get whether the element is [visible](#style/visibility) (i.e. `display: element` and `visibility: visible`).", "formats": [ { "name": "ele.visible", "descr": "Get whether the element is visible." }, { "name": "ele.hidden", "descr": "Get whether the element is hidden." } ] }, { "name": "ele.effectiveOpacity", "descr": "Get the effective opacity of the element (i.e. on-screen opacity), which takes into consideration parent node opacity." }, { "name": "ele.transparent", "descr": "Get whether the element's effective opacity is completely transparent, which takes into consideration parent node opacity." } ] }, { "name": "Animation", "fns": [ { "name": "ele.animated", "descr": "Get whether the element is currently being animated." }, { "name": "eles.animate", "descr": "Animate the elements.", "formats": [ { "args": [ { "name": "options", "descr": "An object containing the details of the animation.", "fields": [ { "name": "position", "descr": "A position to which the elements will be animated." }, { "name": "renderedPosition", "descr": "A rendered position to which the elements will be animated." }, { "name": "style", "descr": "An object containing name-value pairs of style properties to animate." }, { "name": "duration", "descr": "The duration of the animation in milliseconds." }, { "name": "queue", "descr": "A boolean indicating whether to queue the animation (default `true`)." }, { "name": "easing", "descr": "A [`transition-timing-function`](#style/transition-animation) easing style string that shapes the animation progress curve." }, { "name": "complete", "descr": "A function to call when the animation is done." }, { "name": "step", "descr": "A function to call each time the animation steps." } ] } ] } ], "md": "collection/animate" }, { "name": "ele.animation", "descr": "Get an [animation](#animations) for the element.", "formats": [ { "args": [ { "name": "options", "descr": "An object containing the details of the animation.", "fields": [ { "name": "position", "descr": "A position to which the elements will be animated." }, { "name": "renderedPosition", "descr": "A rendered position to which the elements will be animated." }, { "name": "style", "descr": "An object containing name-value pairs of style properties to animate." }, { "name": "duration", "descr": "The duration of the animation in milliseconds." }, { "name": "easing", "descr": "A [`transition-timing-function`](#style/transition-animation) easing style string that shapes the animation progress curve." }, { "name": "complete", "descr": "A function to call when the animation is done." }, { "name": "step", "descr": "A function to call each time the animation steps." } ] } ] } ] }, { "name": "eles.delay", "descr": "Add a delay between queued animations for the elements.", "formats": [ { "args": [ { "name": "duration", "descr": "How long the delay should be in milliseconds." }, { "name": "complete", "descr": "A function to call when the delay is complete." } ] } ], "md": "collection/delay" }, { "name": "ele.delayAnimation", "descr": "Get a delay [animation](#animations) for the element.", "formats": [ { "args": [ { "name": "duration", "descr": "How long the delay should be in milliseconds." } ] } ] }, { "name": "eles.stop", "descr": "Stop all animations that are currently running.", "formats": [ { "args": [ { "name": "clearQueue", "descr": "A boolean, indicating whether the queue of animations should be emptied." }, { "name": "jumpToEnd", "descr": "A boolean, indicating whether the currently-running animations should jump to their ends rather than just stopping midway." } ] } ], "md": "collection/stop" }, { "name": "eles.clearQueue", "descr": "Remove all queued animations for the elements." } ] }, { "name": "Comparison", "fns": [ { "name": "eles.same", "descr": "Determine whether this collection contains exactly the same elements as another collection.", "formats": [ { "args": [ { "name": "eles", "descr": "The other elements to compare to." } ] } ], "md": "collection/same" }, { "name": "eles.anySame", "descr": "Determine whether this collection contains any of the same elements as another collection.", "formats": [ { "args": [ { "name": "eles", "descr": "The other elements to compare to." } ] } ], "md": "collection/anySame" }, { "name": "eles.contains", "pureAliases": ["eles.has"], "descr": "Determine whether this collection contains all of the elements of another collection.", "formats": [ { "args": [ { "name": "eles", "descr": "The other elements to compare to." } ] } ], "md": "collection/contains" }, { "name": "eles.allAreNeighbors", "pureAliases": ["eles.allAreNeighbours"], "descr": "Determine whether all elements in the specified collection are in the neighbourhood of the calling collection.", "formats": [ { "args": [ { "name": "eles", "descr": "The other elements to compare to." } ] } ], "md": "collection/allAreNeighbors" }, { "name": "eles.is", "descr": "Determine whether any element in this collection matches a selector.", "formats": [ { "args": [ { "name": "selector", "descr": "The selector to match against." } ] } ], "md": "collection/is" }, { "name": "eles.allAre", "descr": "Determine whether all elements in the collection match a selector.", "formats": [ { "args": [ { "name": "selector", "descr": "The selector to match against." } ] } ], "md": "collection/allAre" }, { "name": "eles.some", "descr": "Determine whether any element in this collection satisfies the specified test function.", "formats": [ { "args": [ { "name": "function(ele, i, eles)", "descr": "The test function that returns truthy values for elements that satisfy the test and falsey values for elements that do not satisfy the test.", "fields": [ { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being tested." } ] }, { "name": "thisArg", "descr": "The value for `this` within the test function.", "optional": "true" } ] } ], "md": "collection/some" }, { "name": "eles.every", "descr": "Determine whether all elements in this collection satisfy the specified test function.", "formats": [ { "args": [ { "name": "function(ele, i, eles)", "descr": "The test function that returns truthy values for elements that satisfy the test and falsey values for elements that do not satisfy the test.", "fields": [ { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being tested." } ] }, { "name": "thisArg", "descr": "The value for `this` within the test function.", "optional": "true" } ] } ], "md": "collection/every" } ] }, { "name": "Iteration", "fns": [ { "name": "eles.size", "descr": "Get the number of elements in the collection.", "md": "collection/size" }, { "name": "eles.empty", "descr": "Get whether the collection is empty, meaning it has no elements.", "formats": [ { "name": "eles.empty", "descr": "Get whether the collection is empty." }, { "name": "eles.nonempty", "descr": "Get whether the collection is nonempty." } ] }, { "name": "eles.forEach", "pureAliases": ["eles.each"], "descr": "Iterate over the elements in the collection.", "formats": [ { "args": [ { "name": "function(ele, i, eles)", "descr": "The function executed each iteration.", "fields": [ { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being iterated." } ] }, { "name": "thisArg", "descr": "The value for `this` within the iterating function.", "optional": "true" } ] } ], "md": "collection/forEach" }, { "name": "eles.eq", "descr": "Get an element at a particular index in the collection.", "formats": [ { "args": [ { "name": "index", "descr": "The index of the element to get." } ] }, { "name": "eles.first", "descr": "Get the first element in the collection." }, { "name": "eles.last", "descr": "Get the last element in the collection." } ], "md": "collection/eq" }, { "name": "eles.slice", "descr": "Get a subset of the elements in the collection based on specified indices.", "formats": [ { "args": [ { "name": "start", "descr": "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.", "optional": true }, { "name": "end", "descr": "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.", "optional": true } ] } ] }, { "name": "eles.toArray", "descr": "Get the collection as an array, maintaining the order of the elements." } ] }, { "name": "Building & filtering", "fns": [ { "name": "eles.getElementById", "pureAliases": ["eles.$id"], "descr": "Get an element in the collection from its ID in a very performant way.", "formats": [ { "args": [ { "name": "id", "descr": "The ID of the element to get." } ] } ] }, { "name": "eles.union", "pureAliases": [ "eles.add", "eles.or", "eles['u']", "eles['+']", "eles['|']" ], "descr": "Get a new collection, resulting from adding the collection with another one", "formats": [ { "args": [ { "name": "eles", "descr": "The elements to add." } ] }, { "args": [ { "name": "selector", "descr": "Elements in the graph matching this selector are added." } ] } ], "md": "collection/union" }, { "name": "eles.difference", "pureAliases": [ "eles.not", "eles.subtract", "eles.relativeComplement", "eles['\\\\']", "eles['!']", "eles['-']" ], "descr": "Get a new collection, resulting from the collection without some specified elements.", "formats": [ { "args": [ { "name": "eles", "descr": "The elements that will not be in the resultant collection." } ] }, { "args": [ { "name": "selector", "descr": "Elements from the calling collection matching this selector will not be in the resultant collection." } ] } ], "md": "collection/difference" }, { "name": "eles.absoluteComplement", "pureAliases": [ "eles.abscomp", "eles.complement" ], "descr": "Get all elements in the graph that are not in the calling collection.", "md": "collection/absoluteComplement" }, { "name": "eles.intersection", "pureAliases": [ "eles.intersect", "eles.and", "eles['n']", "eles['&']", "eles['.']" ], "descr": "Get the elements in both this collection and another specified collection.", "formats": [ { "args": [ { "name": "eles", "descr": "The elements to intersect with." } ] }, { "args": [ { "name": "selector", "descr": "A selector representing the elements to intersect with. All elements in the graph matching the selector are used as the passed collection." } ] } ], "md": "collection/intersection" }, { "name": "eles.symmetricDifference", "pureAliases": [ "eles.symdiff", "eles.xor", "eles['^']", "eles['(+)']", "eles['(-)']" ], "descr": "Get the elements that are in the calling collection or the passed collection but not in both.", "formats": [ { "args": [ { "name": "eles", "descr": "The elements to apply the symmetric difference with." } ] }, { "args": [ { "name": "selector", "descr": "A selector representing the elements to apply the symmetric difference with. All elements in the graph matching the selector are used as the passed collection." } ] } ], "md": "collection/symmetricDifference" }, { "name": "eles.diff", "descr": "Perform a traditional left/right diff on the two collections.", "formats": [ { "args": [ { "name": "eles", "descr": "The elements on the right side of the diff." } ] }, { "args": [ { "name": "selector", "descr": "A selector representing the elements on the right side of the diff. All elements in the graph matching the selector are used as the passed collection." } ] } ], "md": "collection/diff" }, { "name": "eles.merge", "descr": "Perform a in-place merge of the given elements into the calling collection.", "formats": [ { "args": [ { "name": "eles", "descr": "The elements to merge in-place." } ] }, { "args": [ { "name": "selector", "descr": "A selector representing the elements to merge. All elements in the graph matching the selector are used as the passed collection." } ] } ], "md": "collection/merge" }, { "name": "eles.unmerge", "descr": "Perform an in-place operation on the calling collection to remove the given elements.", "formats": [ { "args": [ { "name": "eles", "descr": "The elements to remove in-place." } ] }, { "args": [ { "name": "selector", "descr": "A selector representing the elements to remove. All elements in the graph matching the selector are used as the passed collection." } ] } ], "md": "collection/unmerge" }, { "name": "eles.filter", "descr": "Get a new collection containing elements that are accepted by the specified filter function or selector.", "formats": [ { "args": [ { "name": "function(ele, i, eles)", "descr": "The filter function that returns truthy values for elements to include and falsey values for elements to exclude.", "fields": [ { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being filtered." } ] }, { "name": "thisArg", "descr": "The value for `this` within the iterating function.", "optional": "true" } ] }, { "name": "eles.filter", "descr": "Get the elements that match the specified selector.", "args": [ { "name": "selector", "descr": "The selector to match against." } ] }, { "name": "eles.nodes", "descr": "Get the nodes that match the specified selector.", "args": [ { "name": "selector", "descr": "The selector to match against." } ] }, { "name": "eles.edges", "descr": "Get the edges that match the specified selector.", "args": [ { "name": "selector", "descr": "The selector to match against." } ] } ], "md": "collection/filter" }, { "name": "eles.sort", "descr": "Get a new collection containing the elements sorted by the specified comparison function.", "formats": [ { "args": [ { "name": "function(ele1, ele2)", "descr": "The sorting comparison function that returns a negative number for `ele1` before `ele2`, 0 for `ele1` same as `ele2`, or a positive number for `ele1` after `ele2`." } ] } ], "md": "collection/sort" }, { "name": "eles.map", "descr": "Get an array containing values mapped from the collection.", "formats": [ { "args": [ { "name": "function(ele, i, eles)", "descr": "The function that returns the mapped value for each element.", "fields": [ { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being mapped." } ] }, { "name": "thisArg", "descr": "The value for `this` within the iterating function.", "optional": "true" } ] } ], "md": "collection/map" }, { "name": "eles.reduce", "descr": "Reduce a single value by applying a function against an accumulator and each value of the collection.", "formats": [ { "args": [ { "name": "function(prevVal, ele, i, eles)", "descr": "The function that returns the accumulated value given the previous value and the current element.", "fields": [ { "name": "prevVal", "descr": "The value accumulated from previous elements." }, { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being reduced." } ] } ] } ], "md": "collection/reduce" }, { "name": "eles.min", "descr": "Find a minimum value in a collection.", "formats": [ { "args": [ { "name": "function(ele, i, eles)", "descr": "The function that returns the value to compare for each element.", "fields": [ { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being searched." } ] }, { "name": "thisArg", "descr": "The value for `this` within the iterating function.", "optional": "true" } ] } ], "md": "collection/min" }, { "name": "eles.max", "descr": "Find a maximum value and the corresponding element.", "formats": [ { "args": [ { "name": "function(ele, i, eles)", "descr": "The function that returns the value to compare for each element.", "fields": [ { "name": "ele", "descr": "The current element." }, { "name": "i", "descr": "The index of the current element." }, { "name": "eles", "descr": "The collection of elements being searched." } ] }, { "name": "thisArg", "descr": "The value for `this` within the iterating function.", "optional": "true" } ] } ], "md": "collection/max" }, { "name": "eles.withinBox", "descr": "Get the elements in the collection that are within the given box, using the renderer's box-selection rules. Only interactive elements are considered.", "formats": [ { "args": [ { "name": "box", "descr": "The box to test against, given as `{ x1, y1, x2, y2 }` or `{ x1, y1, w, h }` in [model co-ordinates](#notation/position)." } ] } ], "md": "collection/withinBox" }, { "name": "eles.hit", "descr": "Get the interactive elements in the collection that are hit by the given position, sorted topmost first by z-order.", "formats": [ { "args": [ { "name": "pos", "descr": "The point to test, given as `{ x, y }` in [model co-ordinates](#notation/position)." }, { "name": "options", "descr": "An object containing options for the function.", "optional": true, "fields": [ { "name": "includeBody", "descr": "A boolean indicating whether to hit test the body of the element (default `true`)." }, { "name": "includeMainLabels", "descr": "A boolean indicating whether to hit test main (node or edge) `label`s (default `true`)." }, { "name": "includeSourceLabels", "descr": "A boolean indicating whether to hit test (edge) `source-label`s (default `true`)." }, { "name": "includeTargetLabels", "descr": "A boolean indicating whether to hit test (edge) `target-label`s (default `true`)." }, { "name": "isTouch", "descr": "A boolean indicating whether to use touch-sized hit thresholds (default `false`)." } ] } ] } ], "md": "collection/hit" }, { "name": "eles.polygonIntersection", "descr": "Get the elements in the collection whose body or label polygonal bounds intersect the specified convex polygon in [model co-ordinates](#notation/position), using the [Separating Axis Theorem](https://en.wikipedia.org/wiki/Hyperplane_separation_theorem).", "formats": [ { "args": [ { "name": "polygon", "descr": "An array of `{ x, y }` points defining the polygon to test against." } ] } ], "md": "collection/polygonIntersection" } ] }, { "name": "Traversing", "fns": [ { "name": "eles.neighborhood", "descr": "Get the neighbourhood of the elements.", "formats": [ { "name": "eles.neighborhood", "pureAliases": ["eles.neighbourhood"], "descr": "Get the open neighbourhood of the elements.", "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] }, { "name": "eles.openNeighborhood", "pureAliases": ["eles.openNeighbourhood"], "descr": "Get the open neighbourhood of the elements.", "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] }, { "name": "eles.closedNeighborhood", "pureAliases": ["eles.closedNeighbourhood"], "descr": "Get the closed neighbourhood of the elements.", "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/neighborhood" }, { "name": "eles.components", "descr": "Get the connected components.", "formats": [ { "name": "eles.components", "descr": "Get the connected components, considering only the elements in the calling collection. An array of collections is returned, with each collection representing a component." }, { "name": "eles.componentsOf", "descr": "Get the connected components to which the passed elements belong. The components consider only the subgraph made by the elements in the calling collection. An array of collections is returned, with each collection representing a component.", "args": [ { "name": "root", "descr": "The components that contain these elements are returned." } ] }, { "name": "ele.component", "descr": "Get the connected component for the calling element. The component considers all elements in the graph." } ] }, { "name": "nodes.edgesWith", "descr": "Get the edges connecting the collection to another collection. Direction of the edges does not matter.", "formats": [ { "args": [ { "name": "eles", "descr": "The other collection." } ] }, { "args": [ { "name": "selector", "descr": "The other collection, specified as a selector which is matched against all elements in the graph." } ] } ], "md": "collection/edgesWith" }, { "name": "nodes.edgesTo", "descr": "Get the edges coming from the collection (i.e. the source) going to another collection (i.e. the target).", "formats": [ { "args": [ { "name": "eles", "descr": "The other collection." } ] }, { "args": [ { "name": "selector", "descr": "The other collection, specified as a selector which is matched against all elements in the graph." } ] } ], "md": "collection/edgesTo" }, { "name": "edges.connectedNodes", "descr": "Get the nodes connected to the edges in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/connectedNodes" }, { "name": "nodes.connectedEdges", "descr": "Get the edges connected to the nodes in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/connectedEdges" }, { "name": "edge.source", "descr": "Get source node of this edge.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/source" }, { "name": "edges.sources", "descr": "Get source nodes connected to the edges in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/sources" }, { "name": "edge.target", "descr": "Get target node of this edge.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/target" }, { "name": "edges.targets", "descr": "Get target nodes connected to the edges in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/targets" }, { "name": "edges.parallelEdges", "descr": "Get edges parallel to those in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/parallelEdges" }, { "name": "edges.codirectedEdges", "descr": "Get edges codirected to those in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/codirectedEdges" }, { "name": "nodes.roots", "descr": "From the set of calling nodes, get the nodes which are roots (i.e. no incoming edges, as in a directed acyclic graph).", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.leaves", "descr": "From the set of calling nodes, get the nodes which are leaves (i.e. no outgoing edges, as in a directed acyclic graph).", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.outgoers", "descr": "Get edges (and their targets) coming out of the nodes in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/outgoers" }, { "name": "nodes.successors", "descr": "Recursively get edges (and their targets) coming out of the nodes in the collection (i.e. the outgoers, the outgoers' outgoers, ...).", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/successors" }, { "name": "nodes.incomers", "descr": "Get edges (and their sources) coming into the nodes in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/incomers" }, { "name": "nodes.predecessors", "descr": "Recursively get edges (and their sources) coming into the nodes in the collection (i.e. the incomers, the incomers' incomers, ...).", "formats": [ { "args": [ { "name": "selector", "descr": "An optional selector that is used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/predecessors" } ] }, { "name": "Search", "md": "collection/algorithms", "fns": [ { "name": "eles.breadthFirstSearch", "pureAliases": [ "eles.bfs" ], "descr": "Perform a [breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search) within the elements in the collection.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root nodes (selector or collection) to start the search from." }, { "name": "visit: function(v, e, u, i, depth)", "descr": "A handler function that is called when a node is visited in the search. The handler returns `true` when it finds the desired node, and it returns `false` to cancel the search.", "optional": true, "fields": [ { "name": "v", "descr": "The current node." }, { "name": "e", "descr": "The edge connecting the previous node to the current node." }, { "name": "u", "descr": "The previous node." }, { "name": "i", "descr": "The index indicating this node is the ith visited node." }, { "name": "depth", "descr": "How many edge hops away this node is from the root nodes." } ] }, { "name": "directed", "descr": "A boolean indicating whether the algorithm should only go along edges from source to target (default `false`).", "optional": true } ] } ] } ], "md": "collection/breadthFirstSearch" }, { "name": "eles.depthFirstSearch", "pureAliases": [ "eles.dfs" ], "descr": "Perform a [depth-first search](https://en.wikipedia.org/wiki/Depth-first_search) within the elements in the collection.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root nodes (selector or collection) to start the search from." }, { "name": "visit: function(v, e, u, i, depth)", "descr": "A handler function that is called when a node is visited in the search. The handler returns `true` when it finds the desired node, and it returns `false` to cancel the search.", "optional": true, "fields": [ { "name": "v", "descr": "The current node." }, { "name": "e", "descr": "The edge connecting the previous node to the current node." }, { "name": "u", "descr": "The previous node." }, { "name": "i", "descr": "The index indicating this node is the ith visited node." }, { "name": "depth", "descr": "How many edge hops away this node is from the root nodes." } ] }, { "name": "directed", "descr": "A boolean indicating whether the algorithm should only go along edges from source to target (default `false`).", "optional": true } ] } ] } ], "md": "collection/depthFirstSearch" }, { "name": "eles.dijkstra", "descr": "Perform [Dijkstra's](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) algorithm on the elements in the collection. This finds the shortest paths to all other nodes in the collection from the root node.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root node (selector or collection) where the algorithm starts." }, { "name": "weight: function(edge)", "descr": "A function that returns the positive numeric weight for the edge. The weight indicates the cost of going from one node to another node.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm should only go along edges from source to target (default `false`).", "optional": true } ] } ] } ], "md": "collection/dijkstra" }, { "name": "eles.aStar", "descr": "Perform the [A*](https://en.wikipedia.org/wiki/A*_search_algorithm) search algorithm on the elements in the collection. This finds the shortest path from the root node to the goal node.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root node (selector or collection) where the search starts." }, { "name": "goal", "descr": "The goal node (selector or collection) where the search ends." }, { "name": "weight: function(edge)", "descr": "A function that returns the positive numeric weight for the edge. The weight indicates the cost of going from one node to another node.", "optional": true }, { "name": "heuristic: function(node)", "descr": "A function that returns an estimation (cannot be overestimation) on the shortest distance from the current node to the goal.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm should only go along edges from source to target (default `false`).", "optional": true } ] } ] } ], "md": "collection/aStar" }, { "name": "eles.floydWarshall", "descr": "Perform the [Floyd-Warshall](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm) search algorithm on the elements in the collection. This finds the shortest path between all pairs of nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "weight: function(edge)", "descr": "A function that returns the numeric weight for the edge. The weight indicates the cost of going from one node to another node. The weight may be positive or negative, but no negative cycles are allowed.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm should only go along edges from source to target (default `false`).", "optional": true } ] } ] } ], "md": "collection/floydWarshall" }, { "name": "eles.bellmanFord", "descr": "Perform the [Bellman-Ford](https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm) search algorithm on the elements in the collection. This finds the shortest path from the starting node to all other nodes in the collection.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root node (selector or collection) where the search starts." }, { "name": "weight: function(edge)", "descr": "A function that returns the numeric weight for the edge. The weight indicates the cost of going from one node to another node. The weight may be positive or negative.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm should only go along edges from source to target (default `false`).", "optional": true } ] } ] } ], "md": "collection/bellmanFord" }, { "name": "eles.hierholzer", "descr": "Perform the [Hierholzer](https://en.wikipedia.org/wiki/Eulerian_path#Hierholzer's_algorithm) search algorithm on the elements in the collection. This finds Eulerian trails and circuits.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root node (selector or collection) where the search starts.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm should only go along edges from source to target (default `false`).", "optional": true } ] } ] } ], "md": "collection/hierholzer" } ] }, { "name": "Spanning", "fns": [ { "name": "eles.kruskal", "descr": "Perform [Kruskal's](https://en.wikipedia.org/wiki/Kruskal%27s_algorithm) algorithm on the elements in the collection, returning the minimum spanning tree, assuming undirected edges.", "formats": [ { "args": [ { "name": "function(edge)", "descr": "A function that returns the positive numeric weight for the edge.", "optional": true } ] } ], "md": "collection/kruskal" } ] }, { "name": "Cut", "fns": [ { "name": "eles.kargerStein", "descr": "Finds the minimum cut in a graph using the [Karger-Stein](https://en.wikipedia.org/wiki/Karger%27s_algorithm#Karger.E2.80.93Stein_algorithm) algorithm. The optimal result is found with a high probability, but without guarantee.", "md": "collection/kargerStein" }, { "name": "eles.hopcroftTarjanBiconnected", "pureAliases": [ "eles.hopcroftTarjanBiconnectedComponents", "eles.htb", "eles.htbc" ], "descr": "Finds the [biconnected components](https://en.wikipedia.org/wiki/Biconnected_component) in an undirected graph, as well as their respective cut vertices, using an algorithm due to Hopcroft and Tarjan.", "md": "collection/hopcroftTarjanBiconnected" }, { "name": "eles.tarjanStronglyConnected", "pureAliases": [ "eles.tarjanStronglyConnectedComponents", "eles.tsc", "eles.tscc" ], "descr": "Finds the [strongly connected components](https://en.wikipedia.org/wiki/Strongly_connected_component) of a directed graph using Tarjan's algorithm.", "md": "collection/tarjanStronglyConnected" } ] }, { "name": "Centrality", "fns": [ { "name": "eles.degreeCentrality", "pureAliases": ["eles.dc"], "descr": "Considering only the elements in the calling collection, calculate the [degree centrality](https://en.wikipedia.org/wiki/Centrality#Degree_centrality) of the specified root node.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root node (selector or collection) for which the centrality calculation is made." }, { "name": "weight: function(edge)", "descr": "A function that returns the positive weight for the edge. The weight indicates the importance of the edge, with a high value representing high importance.", "optional": true }, { "name": "alpha", "descr": "The alpha value for the centrality calculation, ranging on [0, 1]. With value 0 (default), disregards edge weights and solely uses number of edges in the centrality calculation. With value 1, disregards number of edges and solely uses the edge weights in the centrality calculation.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the directed indegree and outdegree centrality is calculated (`true`) or whether the undirected centrality is calculated (`false`, default).", "optional": true } ] } ] } ], "md": "collection/degreeCentrality" }, { "name": "eles.degreeCentralityNormalized", "pureAliases": ["eles.dcn", "eles.degreeCentralityNormalised"], "descr": "Considering only the elements in the calling collection, calculate the normalised [degree centrality](https://en.wikipedia.org/wiki/Centrality#Degree_centrality) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "weight: function(edge)", "descr": "A function that returns the positive weight for the edge. The weight indicates the importance of the edge, with a high value representing high importance.", "optional": true }, { "name": "alpha", "descr": "The alpha value for the centrality calculation, ranging on [0, 1]. With value 0 (default), disregards edge weights and solely uses number of edges in the centrality calculation. With value 1, disregards number of edges and solely uses the edge weights in the centrality calculation.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the directed indegree and outdegree centrality is calculated (`true`) or whether the undirected centrality is calculated (`false`, default).", "optional": true } ] } ] } ], "md": "collection/degreeCentralityNormalized" }, { "name": "eles.closenessCentrality", "pureAliases": ["eles.cc"], "descr": "Considering only the elements in the calling collection, calculate the [closeness centrality](https://en.wikipedia.org/wiki/Closeness_centrality) of the specified root node.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "root", "descr": "The root node (selector or collection) for which the centrality calculation is made." }, { "name": "weight: function(edge)", "descr": "A function that returns the positive weight for the edge. The weight indicates the importance of the edge, with a high value representing high importance.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm operates on edges in a directed manner from source to target (`true`) or whether the algorithm operates in an undirected manner (`false`, default).", "optional": true }, { "name": "harmonic", "descr": "A boolean indicating whether the algorithm calculates the harmonic mean (`true`, default) or the arithmetic mean (`false`) of distances. The harmonic mean is very useful for graphs that are not strongly connected.", "optional": true } ] } ] } ], "md": "collection/closenessCentrality" }, { "name": "eles.closenessCentralityNormalized", "pureAliases": ["eles.ccn", "eles.closenessCentralityNormalised"], "descr": "Considering only the elements in the calling collection, calculate the [closeness centrality](https://en.wikipedia.org/wiki/Closeness_centrality) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "weight: function(edge)", "descr": "A function that returns the positive weight for the edge. The weight indicates the importance of the edge, with a high value representing high importance.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm operates on edges in a directed manner from source to target (`true`) or whether the algorithm operates in an undirected manner (`false`, default).", "optional": true }, { "name": "harmonic", "descr": "A boolean indicating whether the algorithm calculates the harmonic mean (`true`, default) or the arithmetic mean (`false`) of distances. The harmonic mean is very useful for graphs that are not strongly connected.", "optional": true } ] } ] } ], "md": "collection/closenessCentralityNormalized" }, { "name": "eles.betweennessCentrality", "pureAliases": ["eles.bc"], "descr": "Considering only the elements in the calling collection, calculate the [betweenness centrality](https://en.wikipedia.org/wiki/Betweenness_centrality) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "weight: function(edge)", "descr": "A function that returns the positive weight for the edge. The weight indicates the importance of the edge, with a high value representing high importance.", "optional": true }, { "name": "directed", "descr": "A boolean indicating whether the algorithm operates on edges in a directed manner from source to target (`true`) or whether the algorithm operates in an undirected manner (`false`, default).", "optional": true } ] } ] } ], "md": "collection/betweennessCentrality" }, { "name": "eles.pageRank", "descr": "Rank the nodes in the collection using the [Page Rank](https://en.wikipedia.org/wiki/PageRank) algorithm.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "dampingFactor", "descr": "The [damping factor](https://en.wikipedia.org/wiki/PageRank#Damping_factor), affecting how long the algorithm goes along the topology of the graph (default `0.8`).", "optional": true}, { "name": "precision", "descr": "Numeric parameter that represents the required precision (default `0.000001`). The algorithm stops when the difference between iterations is this value or less.", "optional": true }, { "name": "iterations", "descr": "Maximum number of iterations to perform (default `200`).", "optional": true } ] } ] } ], "md": "collection/pageRank" } ] }, { "name": "Clustering", "fns": [ { "name": "eles.markovClustering", "pureAliases": ["eles.mcl"], "descr": "Considering only the elements in the calling collection, run the [Markov cluster algorithm](https://micans.org/mcl/) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "attributes: [ function(edge) ... ]", "descr": "An array of attribute functions, each of which returns a numeric attribute value for the specified edge. Attributes are used to cluster the nodes; i.e. the attributes of an edge indicate similarity between its nodes." }, { "name": "expandFactor", "descr": "A number that affects time of computation and cluster granularity to some extent: `M * M` (default `2`)", "optional": true }, { "name": "inflateFactor", "descr": "A number that affects cluster granularity (the greater the value, the more clusters): `M(i,j) / E(j)` (default `2`)", "optional": true }, { "name": "multFactor", "descr": "Optional number of self loops for each node. Use a neutral value to improve cluster computations (default `1`).", "optional": true }, { "name": "maxIterations", "descr": "Maximum number of iterations of the MCL algorithm in a single run (default `20`).", "optional": true } ] } ] } ], "md": "collection/markovClustering" }, { "name": "nodes.kMeans", "descr": "Considering only the nodes in the calling collection, calculate the [k-means clustering](https://en.wikipedia.org/wiki/K-means_clustering) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "attributes: [ function( node ) ... ]", "descr": "An array of attribute functions, each of which returns a numeric attribute value for the specified node. Attributes are used to cluster the nodes; i.e. two nodes with similar attributes tend to be in the same cluster. Each attribute may have to be normalised in order for the chosen distance metric to make sense. Attributes must be specified unless a custom `distance: function( nodeP, nodeQ )` is specified." }, { "name": "k", "descr": "The number of clusters to return." }, { "name": "distance", "descr": "The distance classifier used to compare attribute vectors. It is optional if attributes are specified. It may take on one of several values:", "fields": [ { "name": "'euclidean'", "descr": "[Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) (default)" }, { "name": "'squaredEuclidean'", "descr": "[Squared Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance)" }, { "name": "'manhattan'", "descr": "[Manhattan distance](https://en.wikipedia.org/wiki/Taxicab_geometry)" }, { "name": "'max'", "descr": "[Max distance](https://en.wikipedia.org/wiki/Uniform_norm)" }, { "name": "function( length, getPAt, getQAt[, nodeP, nodeQ] )", "descr": "A custom function that returns the distance between attribute vectors `p` and `q`.", "fields": [ { "name": "length", "descr": "The length of the vectors." }, { "name": "getPAt(i)", "descr": "A function that returns the ith value of the `p` vector." }, { "name": "getQAt(i)", "descr": "A function that returns the ith value of the `q` vector." } ] } ] }, { "name": "maxIterations", "descr": "The maximum number of iterations of the algorithm to run (default `10`).", "optional": true }, { "name": "sensitivityThreshold", "descr": "The coefficients difference threshold used to determine whether the algorithm has converged (default `0.001`).", "optional": true } ] } ] } ], "md": "collection/kMeans" }, { "name": "nodes.kMedoids", "descr": "Considering only the nodes in the calling collection, calculate the [k-medoids clustering](https://en.wikipedia.org/wiki/K-medoids) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "attributes: [ function( node ) ... ]", "descr": "An array of attribute functions, each of which returns a numeric attribute value for the specified node. Attributes are used to cluster the nodes; i.e. two nodes with similar attributes tend to be in the same cluster. Each attribute may have to be normalised in order for the chosen distance metric to make sense. Attributes must be specified unless a custom `distance: function( nodeP, nodeQ )` is specified." }, { "name": "k", "descr": "The number of clusters to return." }, { "name": "distance", "descr": "The distance classifier used to compare attribute vectors. It is optional if attributes are specified. It may take on one of several values:", "fields": [ { "name": "'euclidean'", "descr": "[Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) (default)" }, { "name": "'squaredEuclidean'", "descr": "[Squared Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance)" }, { "name": "'manhattan'", "descr": "[Manhattan distance](https://en.wikipedia.org/wiki/Taxicab_geometry)" }, { "name": "'max'", "descr": "[Max distance](https://en.wikipedia.org/wiki/Uniform_norm)" }, { "name": "function( length, getPAt, getQAt[, nodeP, nodeQ] )", "descr": "A custom function that returns the distance between attribute vectors `p` and `q`.", "fields": [ { "name": "length", "descr": "The length of the vectors." }, { "name": "getPAt(i)", "descr": "A function that returns the ith value of the `p` vector." }, { "name": "getQAt(i)", "descr": "A function that returns the ith value of the `q` vector." }, { "name": "nodeP", "optional": true, "descr": "An optionally-used reference to the node associated with the `p` attribute vector. It is useful for affecting the weights with information outside of the attributes, such as connectivity." }, { "name": "nodeQ", "optional": true, "descr": "An optionally-used reference to the node associated with the `q` attribute vector. It is useful for affecting the weights with information outside of the attributes, such as connectivity." } ] }, { "name": "function( nodeP, nodeQ )", "descr": "A custom function that returns the distance between `nodeP` and `nodeQ`. This allows for specifying the distance matrix directly, forgoing attributes." } ] }, { "name": "maxIterations", "descr": "The maximum number of iterations of the algorithm to run (default `10`).", "optional": true } ] } ] } ], "md": "collection/kMedoids" }, { "name": "nodes.fuzzyCMeans", "pureAliases": ["nodes.fcm"], "descr": "Considering only the elements in the calling collection, calculate the [fuzzy c-means clustering](https://en.wikipedia.org/wiki/Fuzzy_clustering#Fuzzy_C-means_clustering) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "attributes: [ function( node ) ... ]", "descr": "An array of attribute functions, each of which returns a numeric attribute value for the specified node. Attributes are used to cluster the nodes; i.e. two nodes with similar attributes tend to be in the same cluster. Each attribute may have to be normalised in order for the chosen distance metric to make sense. Attributes must be specified unless a custom `distance: function( nodeP, nodeQ )` is specified." }, { "name": "k", "descr": "The number of clusters to return." }, { "name": "distance", "descr": "The distance classifier used to compare attribute vectors. It is optional if attributes are specified. It may take on one of several values:", "fields": [ { "name": "'euclidean'", "descr": "[Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) (default)" }, { "name": "'squaredEuclidean'", "descr": "[Squared Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance)" }, { "name": "'manhattan'", "descr": "[Manhattan distance](https://en.wikipedia.org/wiki/Taxicab_geometry)" }, { "name": "'max'", "descr": "[Max distance](https://en.wikipedia.org/wiki/Uniform_norm)" }, { "name": "function( length, getPAt, getQAt[, nodeP, nodeQ] )", "descr": "A custom function that returns the distance between attribute vectors `p` and `q`.", "fields": [ { "name": "length", "descr": "The length of the vectors." }, { "name": "getPAt(i)", "descr": "A function that returns the ith value of the `p` vector." }, { "name": "getQAt(i)", "descr": "A function that returns the ith value of the `q` vector." } ] } ] }, { "name": "maxIterations", "descr": "The maximum number of iterations of the algorithm to run (default `10`).", "optional": true }, { "name": "sensitivityThreshold", "descr": "The coefficient difference threshold used to determine whether the algorithm has converged (default `0.001`).", "optional": true } ] } ] } ], "md": "collection/fuzzyCMeans" }, { "name": "nodes.hierarchicalClustering", "pureAliases": ["nodes.hca"], "descr": "Considering only the elements in the calling collection, calculate the agglomerative [hierarchical clustering](https://en.wikipedia.org/wiki/Hierarchical_clustering) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "attributes: [ function( node ) ... ]", "descr": "An array of attribute functions, each of which returns a numeric attribute value for the specified node. Attributes are used to cluster the nodes; i.e. two nodes with similar attributes tend to be in the same cluster. Each attribute may have to be normalised in order for the chosen distance metric to make sense. Attributes must be specified unless a custom `distance: function( nodeP, nodeQ )` is specified." }, { "name": "distance", "descr": "The distance classifier used to compare attribute vectors. It is optional if attributes are specified. It may take on one of several values:", "fields": [ { "name": "'euclidean'", "descr": "[Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) (default)" }, { "name": "'squaredEuclidean'", "descr": "[Squared Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance)" }, { "name": "'manhattan'", "descr": "[Manhattan distance](https://en.wikipedia.org/wiki/Taxicab_geometry)" }, { "name": "'max'", "descr": "[Max distance](https://en.wikipedia.org/wiki/Uniform_norm)" }, { "name": "function( length, getPAt, getQAt[, nodeP, nodeQ] )", "descr": "A custom function that returns the distance between attribute vectors `p` and `q`.", "fields": [ { "name": "length", "descr": "The length of the vectors." }, { "name": "getPAt(i)", "descr": "A function that returns the ith value of the `p` vector." }, { "name": "getQAt(i)", "descr": "A function that returns the ith value of the `q` vector." }, { "name": "nodeP", "optional": true, "descr": "An optionally-used reference to the node associated with the `p` attribute vector. It is useful for affecting the weights with information outside of the attributes, such as connectivity." }, { "name": "nodeQ", "optional": true, "descr": "An optionally-used reference to the node associated with the `q` attribute vector. It is useful for affecting the weights with information outside of the attributes, such as connectivity." } ] }, { "name": "function( nodeP, nodeQ )", "descr": "A custom function that returns the distance between `nodeP` and `nodeQ`. This allows for specifying the distance matrix directly, forgoing attributes." } ] }, { "name": "linkage", "optional": true, "descr": "The [linkage criterion](https://en.wikipedia.org/wiki/Hierarchical_clustering#Linkage_criteria) for measuring the distance between two clusters; may be one of `'mean'`, `'min'` (a.k.a. `'single'`, default), `'max'` (a.k.a. `'complete'`)." }, { "name": "mode", "descr": "The mode of the algorithm. For `'threshold'` (default), clusters are merged until they are at least the specified distance apart. For `'dendrogram'`, the clusters are recursively merged using the branches in a [dendrogram](https://en.wikipedia.org/wiki/Dendrogram) (tree) structure beyond a specified depth." }, { "name": "threshold", "descr": "In `mode: 'threshold'`, distance threshold for stopping the algorithm. All pairs of the returned clusters are at least `threshold` distance apart. Without specifying this value for `mode: 'threshold'`, all clusters will eventually be merged into a single cluster." }, { "name": "dendrogramDepth", "descr": "In `mode: 'dendrogram'`, the depth beyond which branches are merged in the tree. For example, a value of 0 (default) results in all branches being merged into a single cluster." }, { "name": "addDendrogram", "optional": true, "descr": "In `mode: 'dendrogram'`, whether to add nodes and edges to the graph for the dendrogram (default `false`). This is not necessary to run the algorithm, but it is useful for visualising the results." } ] } ] } ], "md": "collection/hierarchicalClustering" }, { "name": "nodes.affinityPropagation", "pureAliases": ["nodes.ap"], "descr": "Considering only the elements in the calling collection, calculate the [affinity propagation clustering](https://en.wikipedia.org/wiki/Affinity_propagation) of the nodes.", "formats": [ { "args": [ { "name": "options", "fields": [ { "name": "attributes: [ function( node ) ... ]", "descr": "An array of attribute functions, each of which returns a numeric attribute value for the specified node. Attributes are used to cluster the nodes; i.e. two nodes with similar attributes tend to be in the same cluster. Each attribute may have to be normalised in order for the chosen distance metric to make sense. Attributes must be specified unless a custom `distance: function( nodeP, nodeQ )` is specified." }, { "name": "distance", "descr": "The distance classifier used to compare attribute vectors. It is optional if attributes are specified. It may take on one of several values:", "fields": [ { "name": "'euclidean'", "descr": "[Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) (default)" }, { "name": "'squaredEuclidean'", "descr": "[Squared Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance)" }, { "name": "'manhattan'", "descr": "[Manhattan distance](https://en.wikipedia.org/wiki/Taxicab_geometry)" }, { "name": "'max'", "descr": "[Max distance](https://en.wikipedia.org/wiki/Uniform_norm)" }, { "name": "function( length, getPAt, getQAt[, nodeP, nodeQ] )", "descr": "A custom function that returns the distance between attribute vectors `p` and `q`.", "fields": [ { "name": "length", "descr": "The length of the vectors." }, { "name": "getPAt(i)", "descr": "A function that returns the ith value of the `p` vector." }, { "name": "getQAt(i)", "descr": "A function that returns the ith value of the `q` vector." }, { "name": "nodeP", "optional": true, "descr": "An optionally-used reference to the node associated with the `p` attribute vector. It is useful for affecting the weights with information outside of the attributes, such as connectivity." }, { "name": "nodeQ", "optional": true, "descr": "An optionally-used reference to the node associated with the `q` attribute vector. It is useful for affecting the weights with information outside of the attributes, such as connectivity." } ] }, { "name": "function( nodeP, nodeQ )", "descr": "A custom function that returns the distance between `nodeP` and `nodeQ`. This allows for specifying the distance matrix directly, forgoing attributes." } ] }, { "name": "preference", "optional": true, "descr": "The metric used to determine the suitability of a data point (i.e. node attribute vector) to serve as an exemplar. It may take on one of several special values, which are determined from the similarity matrix (i.e. the negative distance matrix). Or a manual, numeric value may be used (generally of the opposite sign of your distance values). The special values include:", "fields": [ { "name": "'median'", "descr": "Use the median value of the similarity matrix (default)." }, { "name": "'mean'", "descr": "Use the mean value of the similarity matrix." }, { "name": "'min'", "descr": "Use the minimum value of the similarity matrix." }, { "name": "'max'", "descr": "Use the maximum value of the similarity matrix." } ] }, { "name": "damping", "descr": "A damping factor on [0.5, 1) (default `0.8`).", "optional": true }, { "name": "minIterations", "descr": "The minimum number of iteraions the algorithm will run before stopping (default `100`).", "optional": true }, { "name": "maxIterations", "descr": "The maximum number of iteraions the algorithm will run before stopping (default `1000`).", "optional": true } ] } ] } ], "md": "collection/affinityPropagation" } ] }, { "name": "Compound nodes", "md": "collection/compoundNodes", "fns": [ { "name": "node.isParent", "descr": "Get whether the node is a compound parent (i.e. a node containing one or more child nodes)" }, { "name": "node.isChildless", "descr": "Get whether the node is childless (i.e. a node with no child nodes)" }, { "name": "node.isChild", "descr": "Get whether the node is a compound child (i.e. contained within a node)" }, { "name": "node.isOrphan", "descr": "Get whether the node is an orphan (i.e. a node with no parent)" }, { "name": "nodes.parent", "descr": "Get the compound parent node of each node in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.ancestors", "pureAliases": ["nodes.parents"], "descr": "Get all compound ancestor nodes (i.e. parents, parents' parents, etc.) of each node in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.commonAncestors", "descr": "Get all compound ancestors common to all the nodes in the collection, starting with the closest and getting progressively farther.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ], "md": "collection/commonAncestors" }, { "name": "nodes.orphans", "descr": "Get all orphan (i.e. has no compound parent) nodes in the calling collection.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.nonorphans", "descr": "Get all nonorphan (i.e. has a compound parent) nodes in the calling collection.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.children", "descr": "Get all compound child (i.e. direct descendant) nodes of each node in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.descendants", "descr": "Get all compound descendant (i.e. children, children's children, etc.) nodes of each node in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ] }, { "name": "nodes.siblings", "descr": "Get all sibling (i.e. same compound parent) nodes of each node in the collection.", "formats": [ { "args": [ { "name": "selector", "descr": "A selector used to filter the resultant collection.", "optional": true } ] } ] } ] } ] }, { "name": "Selectors", "md": "selectors" }, { "name": "Style", "md": "style" }, { "name": "Events", "md": "events" }, { "name": "Layouts", "md": "layout/intro", "sections": [ { "md": "layouts/null", "layout": { "name": "null" } }, { "md": "layouts/random", "layout": { "name": "random" } }, { "md": "layouts/preset", "layout": { "name": "preset" } }, { "md": "layouts/grid", "layout": { "name": "grid" } }, { "md": "layouts/circle", "layout": { "name": "circle" } }, { "md": "layouts/concentric", "layout": { "name": "concentric" } }, { "md": "layouts/breadthfirst", "layout": { "name": "breadthfirst" } }, { "md": "layouts/cose", "layout": { "name": "cose" } }, { "name": "Layout manipulation", "md": "layout/manipulation", "fns": [ { "name": "layout.run", "pureAliases": [ "layout.start" ], "descr": "Start running the layout.", "md": "layout/run" }, { "name": "layout.stop", "descr": "Stop running the (asynchronous/discrete) layout.", "md": "layout/stop" } ] }, { "name": "Layout events", "md": "layout/events", "fns": [ { "name": "layout.on", "pureAliases": ["layout.bind", "layout.listen", "layout.addListener"], "descr": "Listen to events that are emitted by the layout.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "data", "descr": "A plain object which is passed to the handler in the event object argument.", "optional": true }, { "name": "function(event)", "descr": "The handler function that is called when one of the specified events occurs.", "fields": [ { "name": "event", "descr": "The event object." } ] } ] } ], "md": "layout/on" }, { "name": "layout.promiseOn", "pureAliases": ["layout.pon"], "descr": "Get a promise that is resolved when the layout emits the first of any of the specified events.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." } ] } ], "md": "layout/promiseOn" }, { "name": "layout.one", "descr": "Listen to events that are emitted by the layout, and run the handler only once.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "data", "descr": "A plain object which is passed to the handler in the event object argument.", "optional": true }, { "name": "function(event)", "descr": "The handler function that is called when one of the specified events occurs.", "fields": [ { "name": "event", "descr": "The event object." } ] } ] } ], "md": "layout/one" }, { "name": "layout.removeListener", "pureAliases": ["layout.off", "layout.unbind", "layout.unlisten"], "descr": "Remove event handlers on the layout.", "formats": [ { "args": [ { "name": "events", "descr": "A space separated list of event names." }, { "name": "handler", "descr": "A reference to the handler function to remove.", "optional": true } ] } ], "md": "layout/removeListener" }, { "name": "layout.removeAllListeners", "descr": "Remove all event handlers on the layout." }, { "name": "layout.emit", "pureAliases": ["layout.trigger"], "descr": "Emit one or more events on the layout.", "formats": [ { "args": [ { "name": "events", "descr": "A list of event names to emit (either a space-separated string or an array)." }, { "name": "extraParams", "descr": "An array of additional parameters to pass to the handler.", "optional": true } ] } ], "md": "layout/emit" } ] } ] }, { "name": "Animations", "md": "animations", "sections": [ { "name": "Animation manipulation", "fns": [ { "name": "ani.play", "pureAliases": ["ani.run"], "descr": "Requests that the animation be played, starting on the next frame. If the animation is complete, it restarts from the beginning.", "md": "animation/play" }, { "name": "ani.playing", "pureAliases": ["ani.running"], "descr": "Get whether the animation is currently playing." }, { "name": "ani.progress", "descr": "Get or set how far along the animation has progressed.", "formats": [ { "name": "ani.progress", "descr": "Get the progress of the animation in percent." }, { "name": "ani.progress", "descr": "Set the progress of the animation in percent.", "args": [ { "name": "progress", "descr": "The progress in percent (i.e. between 0 and 1 inclusive) to set to the animation." } ] }, { "name": "ani.time", "descr": "Get the progress of the animation in milliseconds." }, { "name": "ani.time", "descr": "Set the progress of the animation in milliseconds.", "args": [ { "name": "time", "descr": "The progress in milliseconds (i.e. between 0 and the duration inclusive) to set to the animation." } ] }, { "name": "ani.rewind", "descr": "Rewind the animation to the beginning." }, { "name": "ani.fastforward", "descr": "Fastforward the animation to the end." } ], "md": "animation/progress" }, { "name": "ani.pause", "descr": "Pause the animation, maintaining the current progress.", "md": "animation/pause" }, { "name": "ani.stop", "descr": "Stop the animation, maintaining the current progress and removing the animation from any associated queues.", "md": "animation/stop" }, { "name": "ani.completed", "pureAliases": ["ani.complete"], "descr": "Get whether the animation has progressed to the end." }, { "name": "ani.apply", "descr": "Apply the animation at its current progress.", "md": "animation/apply" }, { "name": "ani.applying", "descr": "Get whether the animation is currently applying." }, { "name": "ani.reverse", "descr": "Reverse the animation such that its starting conditions and ending conditions are reversed.", "md": "animation/reverse" }, { "name": "ani.promise", "descr": "Get a promise that is fulfilled with the specified animation event.", "formats": [ { "descr": "Get a promise that is fulfilled with the next `completed` event." }, { "descr": "Get a promise that is fulfilled with the specified animation event.", "args": [ { "name": "animationEvent", "descr": "A string for the event name; `completed` or `complete` for completing the animation or `frame` for the next frame of the animation." } ] } ], "md": "animation/promise" } ] } ] }, { "name": "Extensions", "md": "extensions" }, { "name": "Performance", "md": "performance" } ] }