I think the number of noes is very large and one of the following will solve your problem.
1: Increase the heap size.
<NEO4J_HOME>/conf/neo4j.conf
# Java Heap Size: by default the Java heap size is dynamically calculated based
# on available system resources. Uncomment these lines to set specific initial
# and maximum heap size.
dbms.memory.heap.initial_size=512m
dbms.memory.heap.max_size=1G