Visualizing JanusGraph: the new TitanDB fork

A quick history lesson

Back in February 2015, we wrote a blog post “Aurelius has been acquired – what now for Titan?”. At the time some said we’d been hasty; that there was huge appetite for an open-source distributed graph database and the Titan project was still safe in the community’s hands.

What actually happened was more confusing. In the end, the Titan project did slow, resulting in a number of competing spinouts. Here’s the Cliffnotes version:

  • February 2015: DataStax acquire Aurelius, the company behind nascent the TitanDB. We predict the end of the Titan project, and then eat our words when Aurelius promise Titan ‘is not going away’.
  • September 2015: Titan 1.0 is released, making use of the Apache-incubated TinkerPop3 stack. To date, this is the first and last stable TitanDB release. The Aurelius team presumably turn their attentions back to DataStax, which is planning its own graph database announcement…
  • April 2016: DataStax Enterprise (DSE) Graph is launched. DSE Graph incorporates TitanDB’s distributed graph setup, but with even closer integration with Cassandra.
  • July 2016: Perhaps sensing a little frustration in the Titan community (or just the strength of interest in graph databases) IBM releases their own fork of the Titan project: IBM Graph. It’s a fully managed and hosted distributed graph database.
  • January 2017: An on-premise distributed graph database called JanusGraph is released. It’s a fork of TitanDB, backed by The Linux Foundation with participants from Expero, Google, IBM and Hortonworks.
  • October 2017: IBM announces the deprecation of IBM Graph, encouraging users to switch to JanusGraph on Compose instead.

That’s where today’s blog post begins.

JanusGraph may have a complex heritage, but beneath the surface it’s running on the Titan graph database. That means you get Titan’s scalability, performance and back-end flexibility, with the reassurance of big-name backers in the community.

It also means it’s remarkably easy to integrate with KeyLines.

Let’s see how it works.

Integrating KeyLines with JanusGraph

Step 1: Install JanusGraph

We found this process pretty straightforward, using JanusGraph’s own documentation.

Out of the box, JanusGraph has a handy range of different configs. It supports all the same persistence engines as Titan (Apache Cassandra, HBase and Oracle BerkeleyDB) plus Google Bigtable. It also supports Spark, Giraph and Hadoop for analytics, and Elasticsearch, Solr and Lucene for as ‘index backends’ for search.

In this example, I chose to use Cassandra as my persistence engine with Elasticsearch as the indexing system, but the JanusGraph docs explain all the different combinations.

Step 2: Connect to JanusGraph

Next up, I need to create my client to connect KeyLines to the JanusGraph instance I’ve got running. Like TitanDB, JanusGraph is queried using Gremlin. It uses a Websocket connection, giving performance that’s ideal for real-time or data streaming scenarios.

To make life easier, there’s a Gremlin JavaScript client available to bridge between KeyLines and the JanusGraph Gremlin server, so my integration code is straightforward:

import { createClient } from 'gremlin';

const client = createClient(8182, 'janusgraph.server.address');

client.execute('g.V().has("name", name)', { name: 'Alice' }, (err, results) => {
  if (err) {
    return console.error(err)


Or if you prefer your JavaScript ES6 flavored…

import { createClient, makeTemplateTag } from 'gremlin';

const client = createClient(8182, 'janusgraph.server.address');
const gremlin = makeTemplateTag(client);

const fetchByName = async (name) => {
  const results = await gremlin`g.V().has('name', ${name})`;



At this point, we have a running JanusGraph instance, and an interface between it and our KeyLines application to fetch data back and forth.

Step 3: Format the data

KeyLines is a database agnostic visualization tool, so you’re able to fetch data from any source and visualize it in a KeyLines chart. The only requirement is that your data be parsed into KeyLines required JSON format first.

As a graph database, JanusGraph is well suited to this. Our data is already stored and queried as nodes and links (or vertices and edges, at least) and the data already comes back as JSON.

We just need to format it into KeyLines JSON, defining nodes, links and properties:

function makeKeyLinesItems(results) {
  var items = [];

  json.forEach(function(data) {
    var objects = data.objects;

    objects.forEach(function(object) {
      if (object.type === 'vertex') {
          type: 'node',
          // Get the `title` property from the returned dataset
          ci: true,
          // Save the item on the node in case we need more info
      } else if(object.type === 'edge') {
          type: 'link',
          id1: object.outV,
          id2: object.inV,
          // Show a link label
          // Save the entire edge on the link for future use
          d: object

  return items;

Step 4: Load the data into KeyLines

The final step is to run some code that submits a Gremlin query to load your JanusGraph data into the KeyLines chart. It would look similar to this:

import { createClient } from 'gremlin';

const client = createClient(8182, 'janusgraph.server.address');

client.execute('g.V().has("name", name)', { name: 'Alice' }, (err, results) => {
  if (err) {
    return console.error(err)

  var keyLinesItems = makeKeyLinesItems(results);


Step 5: Customize your KeyLines app

And that’s it! That’s all you need to do to get KeyLines communicating with a JanusGraph backend.

There are some further steps required to customize your KeyLines application’s styling and UX. There’s plenty of inspiration and demos to get you started on the KeyLines SDK.

You’ll also find our new JanusGraph demo, including the full integration and front-end source code ready to download and play with. Register here to request a free evaluation account for the KeyLines SDK.

our JanusGraph / KeyLines integration
The KeyLines JanusGraph integration demo – available to download, ready for you to customize.

More from our blog

Visit our blog

Registered in England and Wales with Company Number 07625370 | VAT Number 113 1740 61
6-8 Hills Road, Cambridge, CB2 1JP. All material © Cambridge Intelligence 2021.
Read our Privacy Policy.