Don't repeat your full match time and again (it will be a full graph scan
every time)

how much data do you have in your graph after all this is a global query?

so for your query I recommend at least to add a label + index

create index on :Crime(type);

MATCH

(k:Crime {type:"ASSAULT"})-[:CLOSE_TO]->( l:Crime {type:"BATTERY"}),

(k)-[:CLOSE_TO]->(m:Crime {type:"THEFT"}),

(k)-[:CLOSE_TO]->(n: Crime {type:"NARCOTICS"}),

(l)-[:CLOSE_TO]->(m),

(l)-[:CLOSE_TO]->(n),

(m)-[:CLOSE_TO]->(n)

return count(distinct k)) as k_count,  count(distinct l) as l_count,
count(distinct m) as m_count ,   count(distinct n) as n_count;


On Fri, Oct 3, 2014 at 3:30 PM, Mohana Krishna, IIT Bombay, India <
[email protected]> wrote:

> I have issued a following query as part of my application:
>
>
> MATCH
>
> (k{type:"ASSAULT"})-[r1:CLOSE_TO]->( l {type:"BATTERY"}),
>
> (k{type:"ASSAULT"})-[r2:CLOSE_TO]->(m{type:"THEFT"}),
>
> (k{type:"ASSAULT"})-[r3:CLOSE_TO]->(n{type:"NARCOTICS"}),
>
> ( l {type:"BATTERY"})-[r4:CLOSE_TO]->(m{type:"THEFT"}),
>
> ( l {type:"BATTERY"})-[r5:CLOSE_TO]->(n{type:"NARCOTICS"}),
>
> (m{type:"THEFT"})-[r6:CLOSE_TO]->(n{type:"NARCOTICS"})
>
> return count(distinct(k)) as k_count,  count(distinct(l)) as l_count,
> count(distinct(m)) as m_count ,   count(distinct(n)) as n_count;
>
>
> The query is running indefinitely without giving results. I have
> cross-checked but could not find any error. Am I missing something? Is
> there a limit on maximum number of matches that can be done??
>
>  Please help.
>
> --
> 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