Skip to content

@graphty/cytoscape-extensions / index / GraphtyGraphData

Interface: GraphtyGraphData ​

Defined in: cytoscape-extensions/src/graph-data.ts:33

The core methods cytoscape.use(graphtyCytoscape) adds for getting graphs in and out.

Methods ​

graphtyDataset() ​

graphtyDataset(name, options?): Promise<AddedGraph>

Defined in: cytoscape-extensions/src/graph-data.ts:48

Adds a sample dataset: cy.graphtyDataset("karate"), downloaded from graphty.app (options.baseUrl for a mirror of your own). Throws, adding nothing, when the core already holds one of the graph's node ids. options.signal cancels it: once aborted, it rejects with the signal's reason and adds nothing, whatever options.fetch does with the signal.

Parameters ​

name ​

string

options? ​

FetchDatasetOptions

Returns ​

Promise<AddedGraph>


graphtyExport() ​

graphtyExport(format, options?): Promise<string>

Defined in: cytoscape-extensions/src/graph-data.ts:65

Writes the graph as a file's text: every data field, each node's position and parent, and each edge's id, as far as the format holds them (options.onLoss hears about the rest). Hidden elements are written too. On a collection: its nodes, and those of its edges whose two ends are among them.

Parameters ​

format ​

ExportFormat

options? ​

ExportOptions

Returns ​

Promise<string>


graphtyGenerate() ​

graphtyGenerate<N>(name, options): Promise<AddedGraph>

Defined in: cytoscape-extensions/src/graph-data.ts:41

Adds a generated graph: cy.graphtyGenerate("barabasi-albert", { n: 500, m: 2, seed: 1 }). Node ids are "0", "1", ... and edge ids "e0", "e1", ...; ground-truth columns (community, ...) become data fields and weights data.weight. Nodes are placed at the origin (run a layout next), except that a generator's coordinates (positions: true on the lattices; the geometric generators) become node positions, in the generator's own units. Throws, adding nothing, when the core already holds one of the graph's node ids.

Type Parameters ​

N ​

N extends "ak" | "balanced-tree" | "barabasi-albert" | "barbell" | "bianconi-barabasi" | "bipartite-configuration-model" | "caveman" | "chung-lu" | "circular-ladder" | "complete" | "complete-bipartite" | "complete-multipartite" | "configuration-model" | "connected-caveman" | "cycle" | "degree-corrected-sbm" | "directed-configuration-model" | "duplication-divergence" | "empty" | "erdos-renyi" | "erdos-renyi-gnm" | "forest-fire" | "genrmf" | "grid" | "grid-3d" | "grid-flow-network" | "hexagonal-lattice" | "hyperbolic" | "hypercube" | "knn" | "kronecker" | "ladder" | "layered-flow-network" | "lfr" | "lollipop" | "mobius-ladder" | "named" | "newman-watts" | "path" | "petersen" | "planted-partition" | "price" | "random-apollonian" | "random-bipartite" | "random-dag" | "random-geometric" | "random-order-dag" | "random-recursive-tree" | "random-regular" | "random-tree" | "ring-of-cliques" | "rmat" | "star" | "stochastic-block-model" | "triangular-lattice" | "watts-strogatz" | "waxman" | "wheel" | "wilson-maze"

Parameters ​

name ​

N

options ​

GeneratorOptions<N>

Returns ​

Promise<AddedGraph>


graphtyImport() ​

graphtyImport(input, format?, options?): Promise<ImportedGraph>

Defined in: cytoscape-extensions/src/graph-data.ts:55

Adds the graph in a file: GEXF, GraphML, GML, DOT, Pajek, CSV, JSON, Neo4j, XGMML, CX2, CX, OBO or a Cytoscape session (.cys, as bytes). Every attribute becomes a data field, and positions in the file become node positions (y negated for the formats whose y grows upward: GEXF, GML, DOT, Pajek). Throws, adding nothing, when the core already holds one of the graph's node ids.

Parameters ​

input ​

ArrayBuffer | ImportInput

format? ​

ImportFormat

options? ​

ImportOptions

Returns ​

Promise<ImportedGraph>