neoxygen / neogen
Neo4j Graph generator for PHP5.4+
Installs: 197
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 7
Forks: 12
Open Issues: 8
Requires
- php: >=5.4
- doctrine/collections: ~1.2
- fzaninotto/faker: ~1.4
- ikwattro/faker-extra: ~0.3
- jms/serializer: ~0.16
- neoxygen/neoclient: ~2.1
- symfony/console: ~2.5
- symfony/dependency-injection: ~2.5
- symfony/finder: ~2.5
- symfony/yaml: ~2.5
Requires (Dev)
- phpspec/phpspec: ~2.0
- phpunit/phpunit: 4.*
- dev-master / 1.0.x-dev
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.5.13
- 0.5.12
- 0.5.11
- 0.5.10
- 0.5.9
- 0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- dev-localized-faker
- dev-test
- dev-refactoring
- dev-gs
- dev-cypher-import
- dev-rik
- dev-distribution
- dev-fix-frank
- dev-development
- dev-feature_cypher_cmd
- dev-extract-cypher
- dev-nostar
- dev-proof
This package is not auto-updated.
Last update: 2024-11-09 17:55:58 UTC
README
Graph Generator for Neo4j
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.
This is in development
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
Usage
Download the library :
git clone https://github.com/neoxygen/neogen
cd neogen
Define your graph model in YAML :
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
Run the generate command :
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 !
Quick configuration precisions:
- 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
Properties parameters
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"]}
Define your graph model in Cypher :
//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"
Development
Contributions, feedbacks, requirements welcome. Shoot me by opening issues or PR or on twitter : @ikwattro