
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
@ruvector/graph-data-generator
Advanced tools
AI-powered synthetic graph data generation with OpenRouter/Kimi K2 integration for Neo4j knowledge graphs, social networks, and temporal events
AI-powered synthetic graph data generation with OpenRouter/Kimi K2 integration for Neo4j knowledge graphs, social networks, and temporal events.
npm install @ruvector/graph-data-generator
import { createGraphDataGenerator } from '@ruvector/graph-data-generator';
// Initialize with OpenRouter API key
const generator = createGraphDataGenerator({
apiKey: process.env.OPENROUTER_API_KEY,
model: 'moonshot/kimi-k2-instruct'
});
// Generate a knowledge graph
const result = await generator.generateKnowledgeGraph({
domain: 'technology',
entities: 100,
relationships: 300,
includeEmbeddings: true
});
// Get Cypher statements for Neo4j
const cypher = generator.generateCypher(result.data, {
useConstraints: true,
useIndexes: true
});
console.log(cypher);
const knowledgeGraph = await generator.generateKnowledgeGraph({
domain: 'artificial intelligence',
entities: 200,
relationships: 500,
entityTypes: ['Concept', 'Technology', 'Person', 'Organization'],
relationshipTypes: ['RELATES_TO', 'DEVELOPED_BY', 'PART_OF'],
includeEmbeddings: true,
embeddingDimension: 1536
});
const socialNetwork = await generator.generateSocialNetwork({
users: 1000,
avgConnections: 50,
networkType: 'small-world', // or 'scale-free', 'clustered', 'random'
communities: 5,
includeMetadata: true,
includeEmbeddings: true
});
const temporalEvents = await generator.generateTemporalEvents({
startDate: '2024-01-01',
endDate: '2024-12-31',
eventTypes: ['login', 'purchase', 'logout', 'error'],
eventsPerDay: 100,
entities: 50,
includeEmbeddings: true
});
const erGraph = await generator.generateEntityRelationships({
domain: 'e-commerce',
entityCount: 500,
relationshipDensity: 0.3,
entitySchema: {
Product: {
properties: { name: 'string', price: 'number' }
},
Category: {
properties: { name: 'string' }
}
},
relationshipTypes: ['BELONGS_TO', 'SIMILAR_TO', 'PURCHASED_WITH'],
includeEmbeddings: true
});
Generate Neo4j Cypher statements from graph data:
// Basic Cypher generation
const cypher = generator.generateCypher(graphData);
// With constraints and indexes
const cypher = generator.generateCypher(graphData, {
useConstraints: true,
useIndexes: true,
useMerge: true // Use MERGE instead of CREATE
});
// Save to file
import fs from 'fs';
fs.writeFileSync('graph-setup.cypher', cypher);
Enrich graph data with semantic embeddings:
// Add embeddings to existing graph data
const enrichedData = await generator.enrichWithEmbeddings(graphData, {
provider: 'openrouter',
dimensions: 1536,
batchSize: 100
});
// Find similar nodes
const embeddingEnrichment = generator.getEmbeddingEnrichment();
const similar = embeddingEnrichment.findSimilarNodes(
targetNode,
allNodes,
10, // top 10
'cosine' // similarity metric
);
OPENROUTER_API_KEY=your_api_key
OPENROUTER_MODEL=moonshot/kimi-k2-instruct
OPENROUTER_RATE_LIMIT_REQUESTS=10
OPENROUTER_RATE_LIMIT_INTERVAL=1000
EMBEDDING_DIMENSIONS=1536
const generator = createGraphDataGenerator({
apiKey: 'your_api_key',
model: 'moonshot/kimi-k2-instruct',
baseURL: 'https://openrouter.ai/api/v1',
timeout: 60000,
maxRetries: 3,
rateLimit: {
requests: 10,
interval: 1000
}
});
This package extends @ruvector/agentic-synth with graph-specific data generation:
import { createSynth } from '@ruvector/agentic-synth';
import { createGraphDataGenerator } from '@ruvector/graph-data-generator';
// Use both together
const synth = createSynth({ provider: 'gemini' });
const graphGen = createGraphDataGenerator({
apiKey: process.env.OPENROUTER_API_KEY
});
// Generate structured data with synth
const structuredData = await synth.generateStructured({
schema: { /* ... */ }
});
// Generate graph data
const graphData = await graphGen.generateKnowledgeGraph({
domain: 'technology',
entities: 100,
relationships: 300
});
Main class for graph data generation.
generateKnowledgeGraph(options) - Generate knowledge graphgenerateSocialNetwork(options) - Generate social networkgenerateTemporalEvents(options) - Generate temporal eventsgenerateEntityRelationships(options) - Generate entity-relationship graphenrichWithEmbeddings(data, config) - Add embeddings to graph datagenerateCypher(data, options) - Generate Cypher statementsgetClient() - Get OpenRouter clientgetCypherGenerator() - Get Cypher generatorgetEmbeddingEnrichment() - Get embedding enrichmentClient for OpenRouter API.
createCompletion(messages, options) - Create chat completioncreateStreamingCompletion(messages, options) - Stream completiongenerateStructured(systemPrompt, userPrompt, options) - Generate structured dataGenerate Neo4j Cypher statements.
generate(data) - Generate CREATE statementsgenerateMergeStatements(data) - Generate MERGE statementsgenerateIndexStatements(data) - Generate index creationgenerateConstraintStatements(data) - Generate constraintsgenerateSetupScript(data, options) - Complete setup scriptgenerateBatchInsert(data, batchSize) - Batch insert statementsAdd vector embeddings to graph data.
enrichGraphData(data) - Enrich entire graphcalculateSimilarity(emb1, emb2, metric) - Calculate similarityfindSimilarNodes(node, allNodes, topK, metric) - Find similar nodesMIT
rUv - https://github.com/ruvnet
https://github.com/ruvnet/ruvector/tree/main/packages/graph-data-generator
FAQs
AI-powered synthetic graph data generation with OpenRouter/Kimi K2 integration for Neo4j knowledge graphs, social networks, and temporal events
The npm package @ruvector/graph-data-generator receives a total of 7 weekly downloads. As such, @ruvector/graph-data-generator popularity was classified as not popular.
We found that @ruvector/graph-data-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.