1.1.0 • Published 2 years ago

random-graph-data-generator v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Random Graph Data Generator

This package is used to generate dat in csv files and json files required for the grpah db.

How to make it work

  1. npm i -g random-graph-data-generator
  2. random-graph-data-generator -c <total changes count> -r <total revisions> -n <total nodes> -m <root nodes> -e <edges>

Usage

Attributeusageexample
cTotal Changes2
rrevisions per change2
ntotal nodes per revision1000
mselect total root nodes (Grpah construction starts from here)2
erelations between each node3

Example

random-graph-data-generator -c 2 -r 2 -n 10 -m 2 -e 2

then graph looks like this

Random graph generated data

Output

  1. out/relation..csv
  2. out/parts..csv

Use it in Neo4j

LOAD CSV WITH HEADERS FROM "file:///out\relations.csv" AS row
optional Match (src:Material),(dest:Material) where src.id=toInteger(row.source_id) and dest.id=toInteger(row.dest_id)
CALL apoc.create.relationship(src, row.type,{ .*}, dest) YIELD rel
REMOVE rel.noOp

Use it in Postgres

COPY relations FROM '/path/to/csv/relations.csv' WITH (FORMAT csv);