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

import * as neo4j from 'neo4j-driver'
import { nvlResultTransformer, NVL } from '@neo4j-nvl/base'

const run = async () => {
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)
}
  • Parameters

    • result: Result<RecordShape>

    Returns Promise<{
        nodes: Node[];
        recordObjectMap: Map<string, Node<Integer, Properties, string> | Relationship<Integer, Properties, string> | Path<Integer>>;
        relationships: Relationship[];
    }>