Result transformer for the Neo4j JavaScript driver results to NVL graph elements.

import neo4j from "neo4j-driver";
import { nvlResultTransformer, NVL } from "@neo4j-nvl/base";

const driver = neo4j.driver("{uri}", neo4j.auth.basic("{user}", "{password}"));
const nvlGraph = await driver.executeQuery(
"MATCH (a)-[r]-(b) RETURN a,r,b LIMIT 25",
{},
{ resultTransformer: nvlResultTransformer }
);

const nvl = new NVL(document.getElementById('viz'), nvlGraph.nodes, nvlGraph.relationships);

on Neo4j JS Driver API Docs

  • Parameters

    • result: Result<RecordShape>

    Returns Promise<{
        nodes: any[];
        recordObjectMap: Map<any, any>;
        relationships: any[];
    }>

""