The purpose of this Knowledge article is to show you how to use the estimate feature in GDS. This can show the estimated memory usage of a projection or algorithm; using the estimate you can see if the instance is of a suitable size for your intended use.
The examples in this document were produced using the Neo4j GDS Sandbox for demonstration purposes. The data and algorithms being used in this article do not serve any particular purpose, they are only for the purpose of demonstrating how to use estimate in GDS.
1. Firstly we can create a Projection, in this example I will create a Cypher Projection:
We pass the node and relationship Cypher Queries in as usual, but we omit the usual first argument which is the name of the Projection. This is not necessary as we are not creating a Projection, only receiving an estimate of memory usage.
2. You will get the below results back:
We can see how many nodes and relationships are estimated to be in the Projection. The most important thing that we are interested in is the requiredMemory column as well as the treeView column. requiredMemory shows us the memory that we need and treeView shows us a breakdown of what will use the memory. This can be useful to look at if an estimate doesn't match what you are expecting.
3. We can also use estimate to find the estimated memory usage of GDS Algorithms. Firstly we will need to create a Projection. We will create a Projection that matches what we estimated in step 1:
4. We can check our current projections by running CALL gds.graph.list as below:
5. Next we will run an algorithm in estimate mode against this Projection:
You will receive a similar result as was seen with estimating a projection. We can see the memory usage as well as the tree view breakdown of that usage.
6. After we are happy with the memory usage, we can go ahead and execute the algorithm by removing the .estimate:
7. This can be used with any algorithm within GDS in the same way. For Projection we add .estimate and omit the Projection Name and for GDS Algorithms we only need to add the .estimate the rest will stay the same.
For further information on this topic please see our official documentation: https://neo4j.com/docs/graph-data-science/current/common-usage/memory-estimation/
Comments
0 comments
Please sign in to leave a comment.