Online Course Introduction to Graph Algorithms with Neo4j 4.0 Overview of Graph Algorithms Introduction to Graph Data Science library Environment Setup Graph Algorithms Workflow Memory Requirements Estimation Community Detection Algorithms Centrality Algorithms Similarity Algorithms Practical Application of Algorithms Additional Information… Read more →

# Memory Requirements Estimation

### Memory Requirements estimation

The Graph Data Science library operates entirely on heap memory. To avoid running out of memory when dealing with large networks, you can estimate the required memory before executing the algorithms. GDSL supports estimating the required memory to load a named graph as well as to execute a graph algorithm by using the estimate mode.

The general syntax is as follows:

``CALL gds.<ALGO>.<MODE>.estimate()``

All algorithm procedures in the GDSL, including graph creation, will do an estimation check at the beginning of their execution. If the estimation check determines that the current amount of free memory is insufficient to complete the operation, the operation will be aborted, and an error will be reported. This heap control logic is restrictive in the sense that it only blocks executions that are certain to not fit into memory. It does not guarantee that an execution that passed the heap control will succeed without depleting memory. Thus, it is still useful to first run the estimation mode before running an algorithm or graph creation on a large data set to ensure you will not run out of memory.

The amount of free heap memory can be increased by either dropping unused named graphs from the Graph Catalog, or increasing the maximum heap size before starting the Neo4j instance.

### Exercise: Memory requirements estimation

In Neo4j Browser: :play 4.0-intro-graph-algos-exercises and follow the instructions for Memory requirements.

 Note Estimated time to complete: 5 minutes

### Question 1

What algorithms can you estimate heap memory for?

• Betweenness Centrality
• Closeness Centrality
• PageRank
• Label Propagation

### Question 2

When calling estimate() to provide the heap memory estimation for running the algorithm, what information must you provide?

• name of the algorithm
• mode of the algorithm (stream, write)
• amount of heap configured for the instance
• size of the graph

### Question 3

What factors impact the amount of memory available for an algorithm?