1.1.0 • Published 2 years ago
random-graph-data-generator v1.1.0
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
npm i -g random-graph-data-generator
random-graph-data-generator -c <total changes count> -r <total revisions> -n <total nodes> -m <root nodes> -e <edges>
Usage
Attribute | usage | example |
---|---|---|
c | Total Changes | 2 |
r | revisions per change | 2 |
n | total nodes per revision | 1000 |
m | select total root nodes (Grpah construction starts from here) | 2 |
e | relations between each node | 3 |
Example
random-graph-data-generator -c 2 -r 2 -n 10 -m 2 -e 2
then graph looks like this
Output
- out/relation..csv
- 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);