How long does it take? 
And is this the first run or a subsequent run?

I don't thing you get faster by starting at the infected relationships. At 
least not with cypher.

> START x=node:person("infTime:*")
> 
> MATCH x-[r:infected]->()
> 
> RETURN x, count(r) as fof
> 
> order by fof desc
> 
> 
>              limit 1

If you already have a sensible threshold, like 10 or 100 you might use that too.

> START x=node:person("infTime:*")
> 
> MATCH x-[r:infected]->()
> 
> WITH x, count(r) as fof
> 
                WHERE fof > 10
> return fof, x
> 
> order by fof desc
> 
> limit 1
Am 08.01.2014 um 19:19 schrieb mina sh <[email protected]>:

> thank you very much.
> I have another question, in this case that I have a infected relationship, 
> can I get the query that return the node that has the most outgoing infected 
> link (this is the node that infect others the most)
> I wrote a query but it takes a lot to return the answer.this is becuase i 
> start from all node "(infTime:*)". I want to know is there a way to get query 
> by starting from the "infected" relationship and get that query?
> (infTime is a propety that for example infTime=10 shows the node get infected 
> in the time 10)
> 
> START x=node:person("infTime:*")
> 
> MATCH x-[r:infected]->()
> 
> WITH x, count(r) as fof
> 
> return fof, x
> 
> order by fof desc
> 
> limit 1
> 
> On Monday, January 6, 2014 3:23:12 PM UTC+3:30, Michael Hunger wrote:
> You would model those infected-by information relationships between the 
> nodes, not as property containing a number.
> 
> Then you can use variable length paths to do long and also circular matches 
> in the graph.
> 
> MATCH p=(n:Person {name:"Mina"})-[:INFECTED_BY*]->(m)
> RETURN path,m
> 
> HTH
> 
> Michael
> 
> Am 06.01.2014 um 09:36 schrieb mina sh <[email protected]>:
> 
>> i want to get recursive query in neo4j with cypher.
>> in dataset ,nodes has property "whom" that shows the node get infected by 
>> whom
>> (for exmaple node[1] is infected by node[10].-> node(1).whom= 10 )
>> i want to search the graph recurively from the node[1] to node [10] and 
>> recursively so on to reach to the first node that has a whom=0 .
>> 
>> -- 
>> 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/groups/opt_out.
> 
> 
> -- 
> 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/groups/opt_out.

-- 
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/groups/opt_out.

Reply via email to