Skip to content

Developer Guide

Getting Started with VaagaGraph

Follow this 60-second tutorial to embed VaagaGraph in your Node.js application, AWS Lambda, or container runtime.

1. Install Package

Install the embedded engine or SDK into your project:

npm install @vaagatech/vaaga-graph @vaagatech/vaaga-graph-sdk

2. Initialize Embedded Engine

Open a graph with local filesystem WAL persistence:

import { VaagaiGraph, FileSystemStorage } from '@vaagatech/vaaga-graph';

// Open graph with local filesystem WAL persistence
const graph = await VaagaiGraph.open({
  storage: new FileSystemStorage('./data/graph'),
  snapshotKey: 'graph.json',
  persistenceMode: 'wal',
  autoPersist: true,
});

3. Upsert Nodes & Edges

Create entities and connect them with weighted relationships:

// Create nodes
graph.upsertNode({
  id: 'user_1',
  labels: ['User'],
  props: { name: 'Karthik', city: 'Bengaluru' }
});

graph.upsertNode({
  id: 'user_2',
  labels: ['User'],
  props: { name: 'Vikashini', city: 'Chennai' }
});

// Connect with directed weighted relationship
graph.upsertEdge({
  id: 'e1',
  from: 'user_1',
  to: 'user_2',
  type: 'INTERESTED_IN',
  weight: 0.95,
  props: { since: Date.now() }
});

4. Execute Dynamic Match Threshold & Traversals

Query with fractional threshold matching and algorithms:

import { GraphAlgorithms } from '@vaagatech/vaaga-graph';

// 1. Dynamic Match Threshold query (e.g. 50% threshold)
const matches = graph.queryDynamicMatch({
  label: 'User',
  threshold: 50,
  props: { city: 'Chennai' },
  connections: [{ type: 'INTERESTED_IN' }]
});

// 2. Shortest Path BFS algorithm
const path = GraphAlgorithms.shortestPathBfs(graph, 'user_1', 'user_2');
console.log(path); // ['user_1', 'user_2']

5. Running as Standalone Distributed Server

Launch HTTP gateway (port 4000) and Binary TCP (port 4001):

npx vaaga-graph start --port 4000 --tcp-port 4001 --storage fs --data-dir ./data/graph
Read Complete API & SDK Reference →