The Graph Engine

Features

Introduction

The graph engine powers the analysis features in KeyLines, keeping them separate from the methods used to render charts. This allows you to build a graph engine, loading any data, and run graph functions, such as traversals and SNA computations, without having to display every chart item first.

A graph engine considers the underlying level of the chart and so is particularly suited to calculating neighbours or centrality measures.

Graph Engine Advantages

There are many advantages to using the graph engine, particularly when working with large datasets:

  • You don't have to manipulate the chart to run graph analysis.
  • You can carry out analysis on a subset of the rendered graph.
  • It allows you to use the analysis functions of KeyLines without also rendering the graph visualisation, so you can run graph calculations on larger datasets without having to wait for charts to display.
  • It's quicker and easier to carry out graph traversals such as shortestPath, and social network analysis metrics, including degrees or betweenness.
  • It's integrated into KeyLines already, so there's no need to add extra files.

The Graph Engine also can be used in a server-side Node.js application.

Note that the graph engine is not a graph database. It's designed to perform graph traversals and run efficiently in a web browser, not to hold billions of nodes and edges in a back-end environment.

Getting started

These steps show how to create a Graph Engine using getGraphEngine(), and perform computation tasks without rendering the chart.

Step 1 - Create a Graph Engine instance:

const graph = KeyLines.getGraphEngine();

Step 2 - Use the KeyLines Graph Engine API to load the data:

const data = { type: 'LinkChart', items:  [ ... ] };
graph.load(data);

You can also load a saved chart (or serialize the current one) in the Graph Engine instance:

graph.load(chart.serialize());

Step 3 - Perform the graph traversals or SNA computations:

const degrees = graph.degrees();

Graph Engines in NodeJS

You can use the graph engine in any javascript environment, including NodeJS.

Here are some useful code-snippets to set up the KeyLines Graph Engine in NodeJS.

Step 1 - Import keylines:

import KeyLines from 'keylines/esm';

Step 2 - Create a Graph Engine instance:

const graph = KeyLines.getGraphEngine();

Step 3 - Use the KeyLines Graph Engine API to load data:

const data = {type: 'LinkChart', items:  [ ... ]};
graph.load(data);

or load a saved chart in the Graph Engine instance:

graph.load(savedChart);

Step 4 - Perform the graph traversals or SNA computations:

const degrees = graph.degrees();

See Also

The KeyLines graph engine comes with many centrality measures that can be used for social network analysis. See the Graph Centrality documentation for details.

A Graph Engine instance offers every function available in chart.graph(), plus methods to load and manipulate the data. If a method in the API Reference is labelled +graphOnly(), it's only available in the Graph Engine.

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.