cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Generate a graph with a script or to edit it manually in the Neo4j user interface?

I intend to document some stuff as a graph in neo4j (instead of using a wiki or confluence or so).
Now I wonder what is an efficient and sustainable approach to do that.
Where should I keep the "source of truth"?

  1. Use the Neo4j user interface to enter the nodes and relations directly.
  2. Have text files with Cypher statements - in order to add content, edit those files.
  3. Have the content in a text file (e.g. yaml, toml format). Build a script to generate the graph.
  4. Build a application with a custom user interface and use that application. (seems too much effort....)
  5. ....

I expect that it will be more efficient to generate some parts of the graph (nodes and relations).

1 ACCEPTED SOLUTION

How complex is the graph? Approach 1 works for small graphs, but you will have to rely on your memory should you ever need to rebuild it. It is also the only approach you listed that cannot be put into version control, like git, cvs, ClearCase, etc.

I've used #2 on a few projects, but admit I occasionally forget to copy a Cypher statement to the text file once I get the statement working and have to reconstruct it if it goes too far back in history.

My favorite option is to create either a Jupyter notebook or script in one of the supported languages (I use Python and R) that can rebuild the graph. My graphs typically pull from several SQL database sources, and I need to combine the data before going into a graph, so this is usually the best option for me. Think about whether you might need to do this for your graph in the future.

View solution in original post

2 REPLIES 2

How big do you expect your graph to be?

If it is quite small, then I would go with a file containing cypher statements, otherwise you might think of some script to generate the graph as executing cypher statements from a text file tend to get slow when your graph reaches 10k+ nodes or so.

How complex is the graph? Approach 1 works for small graphs, but you will have to rely on your memory should you ever need to rebuild it. It is also the only approach you listed that cannot be put into version control, like git, cvs, ClearCase, etc.

I've used #2 on a few projects, but admit I occasionally forget to copy a Cypher statement to the text file once I get the statement working and have to reconstruct it if it goes too far back in history.

My favorite option is to create either a Jupyter notebook or script in one of the supported languages (I use Python and R) that can rebuild the graph. My graphs typically pull from several SQL database sources, and I need to combine the data before going into a graph, so this is usually the best option for me. Think about whether you might need to do this for your graph in the future.