Skip to content

@graphty/cytoscape-extensions / samples / generateElements

Function: generateElements() ​

generateElements<N>(name, options): SampleElements

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

Generates a graph. Ground-truth columns (community, side, layer, ...) become node data fields; weights become data.weight; coordinates (x and y) become node positions. Edge k gets the id "e<k>", so the same options and seed give the same element ids as well as the same graph.

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

the generator

options ​

GeneratorOptions<N>

the generator's options

Returns ​

SampleElements

the elements and the direction

Throws ​

RangeError for an unknown generator name, or an option the generator does not take