Can you try to use a WHERE condition instead.

MATCH (a:User)-[:TRUSTS]->()-[:TRUSTS]->(c:User)WHERE (c)-[:TRUSTS]->(a)

RETURN count(*) AS cnt;

or

MATCH (a:User)-[:TRUSTS]->()-[:TRUSTS]->(c:User)
WITH a,c, count(*) as countWHERE (c)-[:TRUSTS]->(a)

RETURN sum(count) AS cnt;


Also the profile you shared uses a different query.
Do you have the database accessible somewhere?


On Wed, Jan 4, 2017 at 2:04 AM, chathura kankanamge <
[email protected]> wrote:

> I ran a query to match all 'diamond patterns' on the Epinions1 dataset
> <https://snap.stanford.edu/data/soc-Epinions1.html> (75877 nodes/ 508836
> edges) for an academic project and found that Neo4j needs >100g of heap
> during the evaluation. The query I used was,
>
>
> MATCH (a:User)-[:TRUSTS]->(b:User)-[:TRUSTS]->(c:User), (c)-[:TRUSTS]->(a)
> WITH count(*) AS cnt
> RETURN cnt;
>
>
>
> <https://lh3.googleusercontent.com/-RQIVSMvrgFo/WGxGcafFogI/AAAAAAAAAio/98cmtz8j4fw6IyQswY6yi1cY3slJ_CxqQCLcB/s1600/neo4j_query_plan_epinions_diamond.png>
>
>
> The count I got back was 286,371,276.
>
> The heap size seems too large given the number of intermediate results in the 
> query plan estimates.
>
> Can the memory usage be because the final results are being stored in memory 
> too? How big are intermediate/ final record row objects on average?
>
>
> Thanks,
>
> Chathura
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to