Skip to content

Latest commit

 

History

History

broadcast

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@gephi/gephi-lite-broadcast

The package @gephi/gephi-lite-broadcast is a browser TypeScript library to control a Gephi Lite instance using the Broadcast Channel API.

It exports a Driver class, that exposes various asynchronous methods to help feed Gephi Lite data, appearance settings, filters...

Here is a simple example to import a Graphology graph in Gephi Lite in a new tab:

import { GephiLiteDriver } from "@gephi/gephi-lite-broadcast";
import Graph from "graphology";

async function openGraphInGephiLite(graph: Graph) {
  const driver = new GephiLiteDriver();

  await new Promise<void>((resolve) => {
    // Wait for new instance to be fully working:
    driver.on("newInstance", () => {
      resolve();
    });
    driver.openGephiLite();
  });

  await driver.importGraph(graph.toJSON());

  driver.destroy();
}

TODO

1. Data update/reading:

  • getGraph(): SerializedFullGraph / importGraph(graph: FullGraph)
  • setGraphDataset / getGraphDataset / mergeGraphDataset
  • setGraphAppearance / getGraphAppearance / mergeGraphAppearance
  • setFilters / getFilters
  • setSelection / getSelection

2. Other methods:

  • ping (to check broadcast status)
  • getVersion
  • zoomToNodes / resetZoom
  • computeMetric
  • computeLayout / startLayout / stopLayout
  • notify
  • exportGraph
  • methods to handle UI elements (right panel, left tabs, caption, fullscreen)

3. Events

  • instanceCreation
  • graphUpdate
  • graphModelUpdate
  • graphAppearanceUpdate
  • filtersUpdate
  • selectionUpdate