Skip to content

@graphty/graphty-element / session / createGraphSession

Function: createGraphSession() ​

createGraphSession(options?): GraphSession

Defined in: graphty-element/src/session/GraphSession.ts:1773

Build a graph session.

With no arguments it builds a graph of its own: its own store, its own coordinates, its own accelerator, disposed with it. That is the headless case -- a CI job, a Node test, a check on a server -- and it needs no canvas, no GPU and no DOM.

The session is the only writer of its graph and settings, which is what makes every change an undoable step: data arrives through session.data.import, addNodes and addEdges, and settings through session.config.set.

Parameters ​

options? ​

CreateGraphSessionOptions = {}

the starting configuration, the accelerator and how runs execute, each optional

Returns ​

GraphSession

the session

Example ​

ts
import { createGraphSession } from "@graphty/graphty-element/session";

const session = createGraphSession();
console.log(session.status.counts.nodes, session.data.statistics().components.count);
session.dispose();