The library ease the generation of test graphs. The faker library is also used to generate random property values.
You can define your graph model in YAML or in a slightly modified Cypher pattern.
The library is in its early stage and is targetted to be used in developement environment.
This library is the heart of the popular Graphgen web application
git clone https://github.com/neoxygen/neogen
cd neogen
connection:
scheme: http
host: localhost
port: 7474
nodes:
persons:
label: Person
count: 50
properties:
firstname: firstName
lastname: lastName
companies:
label: Company
count: 10
properties:
name: company
description: catchPhrase
relationships:
person_works_for:
start: persons
end: companies
type: WORKS_AT
mode: n..1
friendships:
start: persons
end: persons
type: KNOWS
mode: n..n
vendor/bin/neogen generate
or you may want to export the generation queries to a file, handy for importing it in the Neo4j Console :
./vendor/bin/neogen generate --export="myfile.cql"
See the results in your graph browser !
- When defining properties types (like company, firstName, ...), these types refers to the standard faker types.
- count define the number of nodes you want
- relationship mode : 1 for only one existing relationship per node, random for randomized number of relationships
Sometimes you'll maybe want to define some parameters for your properties, for e.g. to have a realistic date of birth for Person
nodes,
you may want to be sure that the date will be between 50 years ago and 18 years ago if you set dob for people working for a company.
nodes:
persons:
label: Person
count: 10
properties:
firstname: firstName
date_of_birth: { type: "dateTimeBetween", params: ["-50 years", "-18 years"]}
relationships:
person_works_for:
start: persons
end: companies
type: WORKS_AT
mode: random
properties:
since: { type: "dateTimeBetween", params: ["-10 years", "now"]}
//eg:
(person:Person {firstname:firstName, lastname:lastName} *30)-[:KNOWS *n..n]->(person)
(person)-[:WORKS_AT *n..1]->(company:Company {name:company, slogan:catchPhrase} *5)
For a complete description, see the Graphgen documentation
Generating the graph from a cypher pattern :
./bin/neogen generate-cypher --source="pattern.cypher" --export="export.gen"
Or you may want to import the graph directly in an accessible neo4j database :
./bin/neogen generate-cypher --source="pattern.cypher" --export-db="localhost:7474"
Contributions, feedbacks, requirements welcome. Shoot me by opening issues or PR or on twitter : @ikwattro