Skip to content

@graphty/cytoscape-extensions / samples / datasetElements

Function: datasetElements() ​

datasetElements(name, options?): Promise<SampleElements>

Defined in: cytoscape-extensions/src/samples.ts:244

Loads a sample dataset from graphty.app (see graph-samples' DATASETS for the list, with each one's source, citation and license). A drawn dataset's saved x and y become node positions, placed where Cytoscape drew them.

Parameters ​

name ​

string

the dataset name, e.g. "karate"

options? ​

FetchDatasetOptions = {}

the base URL (a mirror of your own), the fetch implementation and an abort signal

Returns ​

Promise<SampleElements>

the elements and the direction

Throws ​

the signal's reason (an AbortError) when it is aborted before the dataset is decoded

Throws ​

RangeError for a name that is not a known dataset, unless baseUrl is given