match p = (n)-[:LinkTo*1..]->(m) WHERE SIZE ( (m)-[:LinkTo]->() ) = 0
return p, length(p) order by length(p) desc limit 10 or match (n),(m) with n, m where id(n) < id(m) match p = shortestPath( (n)-[:LinkTo*1..]->(m) ) return p, length(p) order by length(p) desc limit 10 On Sun, Jan 22, 2017 at 11:06 AM, Krishna Mahi <[email protected]> wrote: > I have been trying hard to find out longest path in a complex network. I > have been through many questions in StackOverflow and Internet, but none > could help me. I have written a CQL as > > start n=node(*) > match p = (n)-[:LinkTo*1..]->(m) > with n,MAX(length(p)) as L > match p = (n)-[:LinkTo*1..]->(m) > where length(p) = L > return p,L > > > I don't get any solution. Neo4J would keep running for the answer, and I > also tried executing it in Neo4J Cloud Hosting. I didn't any solution even > there, but got an error "Error undefined-undefined" I am in dire need of a > solution. The result for this answer will help me complete my project. So, > anyone please help me in correcting the query. > > -- > 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.
